I am working on Cake 2.4 and if i debug $this in my controller, then $this->Model is not set but should.
Controller: CustomersController(.php)
Model: CustomerModel(.php)
Since the naming Conventions are right, i have no clue where the issue is be located.
RELEVANT Code:
Customer.php:
<?php
class Customer extends Shop {
public $validate = array(/* ... */);
protected $_schema = array(/* ... */);
public function beforeSave($options = array()) {
parent::beforeSave($options);
}
}
CustomersController.php:
<?php
App::uses('ShopsController', 'Controller');
class CustomersController extends ShopsController {
public function beforeFilter() {
$this->Auth->allow('login');
parent::beforeFilter();
}
}
Your model filename is wrong. It should be "Customer" without the "Model" suffix. Only this way it gets automatically loaded and become available as $this->Customer in your controller.
Edit: You're extending not AppModel but ShopModel for some reason (Why?), so try this in your Customer model:
CakePHP does not properly merge/update all properties when you inherit controllers or models.