Cakephp Classroom image

Anil  Bist / Professional / Web Technology

 
To post your Question Join Classroom
 
Lesson Topics's No:-  First|5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13|Last
Lessons:-Models

Possible keys for HABTM association arrays include:
• className: the classname of the model being associated to the current model. If you’re defining a
‘Recipe HABTM Ingredient’ relationship, the className key should equal ‘Ingredient.’
• joinTable: The name of the join table used in this association (if the current table doesn’t adhere to
the naming convention for HABTM join tables).
• with: Defines the name of the model for the join table. By default CakePHP will auto-create a modelfor you. Using the example above it would be called IngredientsRecipe. By using this key you can
override this default name. The join table model can be used just like any “regular” model to access
the join table directly. By creating a model class with such name and filename you can add any custom
behavior to the join table searches, such as adding more information/columns to it
• foreignKey: the name of the foreign key found in the current model. This is especially handy if
you need to define multiple HABTM relationships. The default value for this key is the underscored,
singular name of the current model, suffixed with ‘_id’.
• associationForeignKey: the name of the foreign key found in the other model. This is especially
handy if you need to define multiple HABTM relationships. The default value for this key is the
underscored, singular name of the other model, suffixed with ‘_id’.
• unique: boolean or string keepExisting.
– If true (default value) cake will first delete existing relationship records in the foreign keys
table before inserting new ones. Existing associations need to be passed again when updating.
– When false, cake will insert the relationship record, and that no join records are deleted
during a save operation.
– When set to keepExisting, the behavior is similar to true, but existing associations are
not deleted.
• conditions: an array of find() compatible conditions or SQL string. If you have conditions on an
associated table, you should use a ‘with’ model, and define the necessary belongsTo associations on
it.
• 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
• limit: The maximum number of associated rows you want returned.
• offset: The number of associated rows to skip over (given the current conditions and order) before
fetching and associating.
• finderQuery, deleteQuery, insertQuery: A complete SQL query CakePHP can use to fetch, delete,
or create new associated model records. This should be used in situations that require very custom
results.
Once this association has been defined, find operations on the Recipe model will also fetch related Tag
records if they exist:
// Sample results from a $this->Recipe->find() call.
Array
(
[Recipe] => Array
(
[id] => 2745
[name] => Chocolate Frosted Sugar Bombs
[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)