Cakephp Classroom image

Anil  Bist / Professional / Web Technology

 
To post your Question Join Classroom
 
Lesson Topics's No:-  First|1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9|Last
Lessons:-Models

Possible keys for belongsTo association arrays include:
• className: the classname of the model being associated to the current model. If you’re defining a
‘Profile belongsTo User’ relationship, the className key should equal ‘User.’
• foreignKey: the name of the foreign key found in the current model. This is especially handy if you
need to define multiple belongsTo relationships. The default value for this key is the underscored,
singular name of the other model, suffixed with _id.
• conditions: an array of find() compatible conditions or SQL strings such as
array(’User.active’ => true)
• type: the type of the join to use in the SQL query, default is LEFT which may not fit your needs in all
situations, INNER may be helpful when you want everything from your main and associated models
or nothing at all! (effective when used with some conditions of course). (NB: type value is in lower
case - i.e. left, inner)
• fields: A list of fields to be retrieved when the associated model data is fetched. Returns all fields by
default.• order: an array of find() compatible order clauses or SQL strings such as
array(’User.username’ => ’ASC’)
• counterCache: If set to true the associated Model will automatically increase or decrease the “[singular_
model_name]_count” field in the foreign table whenever you do a save() or delete(). If
it’s a string then it’s the field name to use. The value in the counter field represents the number of
related rows. You can also specify multiple counter caches by using an array where the key is field
name and value is the conditions. E.g.:
array(
’recipes_count’ => true,
’recipes_published’ => array(’Recipe.published’ => 1)
)
• counterScope: Optional conditions array to use for updating counter cache field.
Once this association has been defined, find operations on the Profile model will also fetch a related User
record if it exists:
//Sample results from a $this->Profile->find() call.
Array
(
[Profile] => Array
(
[id] => 12
[user_id] => 121
[skill] => Baking Cakes
[created] => 2007-05-01 10:31:01
)
[User] => Array
(
[id] => 121
[name] => Gwoo the Kungwoo
[created] => 2007-05-01 10:31:01
)
)

 
 
 
image
Anil  Bist

Skills    Cakephp

Qualifications :- High School - SLV, College/University - Graphic Era Deemed Univ University,
Location :-Dehradun,Dehradun,Uttarakhand,India
Description:-

I started my Professional Journey in 2006 with one of the Web Development Company in Bangalore and my 1st framework was "Ruby on Rail" as Web development and delivered around 5+ Projects using this platform. Then came another dimension as JEE/Sturst framework, Gradually I realized that I want to build something on my own and give my passion and energy on creating something different a
Explore

 

  Students (0)