Skip to main content

Posts

Showing posts with the label Association in Cakephp Model

Model in Cakephp

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',           ...