CakePHP version 0.10.0.1217_alpha Released!
这个版本的 Cake 有了不少修改,需要修改模块变量名等等,具体关键的修改如下:
Any instance of a model should be referenced as CamelCase.
(old) $this->models['post']->findAll()
(new) $this->Post->findAll().
2. Association References
Associated data is returned in ModelName array now.
(old) $data['modelname']['id'];
(new) $data['ModelName']['id'];
3. CamelCased models with associations:
All Associations should be singular CamelCased, since we are associating models.
var $belongTo = 'SomeOtherModel,SomeOtherModel1';
var $hasOne = 'SomeOtherModel,SomeOtherModel1';
var $hasMany = 'SomeOtherModel,SomeOtherModel1';
var $hasAndBelongsToMany = 'SomeOtherModel,SomeOtherModel1';
For more information on associations:
http://wiki.cakephp.org/docs:understanding_associations
4. Table underscores:
If you CamelCase your models to replicate your database tables.
The table names and URLs to the controller will be automatically underscored on PHP5.
On PHP4 set your controller (var $name ='Posts') and model (var $name = 'Post')
Adding var $useTable = 'my_underscore_table'; to your model can also be used if
your table name is different from your model name.
5. CamelCase on helpers and components.
var $components = array('ComponentName');
accessing components in the controller is CamelCased
$this->ComponentName->method()
var $helpers = array('Html','HelperName');
accessing helpers in the view is camelBacked
$helperName->method()
6. Update to database.php.default
You must now set connection type.
The port is optional同时我也更新了 Cake AJAX Blog Demo,使可以在最新的版本 Cake_0.10.0.1217_alpha 下运行。
