Models are the classes that sit as the business layer in your application. This means that they should be responsible for managing almost everything that happens regarding your data, its validity, interactions and evolution of the information workflow in your domain of work. Define Model App :: uses ( ’AppModel’ , ’Model’ ); class Member extends AppModel { var $name='Member'; } Association in Model 1# HasOne : One to one relation with two tables public $hasOne = array ( ’Profile’ => array ( ’className’ => ’Profile’ , ’ foreignKey’ => ’user_id’ , ’dependent’ => true ) ); Notes: Here foreignKey founds in the other model. 2# HasMany: One to many var $hasMany=array( 'BusinessHours'=>array( 'className'=>'BusinessHours', ...
Coding Cheatsheets - Learn web development code and tutorials for Software developers which will helps you in project. Get help on JavaScript, PHP, XML, and more.