In Laravel the set{Attribute}Attribute accessor methods are used to set new attributes in a model. For example, we do use $appends property to create our popular “full_name” attribute to combine “first_name” and “last_name” attributes. Following the syntax to define $appends…
Tag: association
Saving multi-level associated data in CakePHP
In CakePHP 2 we had hasMany, saveMany, saveAssociated model methods or functions to save associated data. These functions works great with straight associations but to make them work for saving multi-level association data you need a trick.
Containable with mixed arguments, the CakePHP Beauty!
Here’s an example of CakePHP Containable behaviour. Although, it was not a very complex find call but the beauty of the containable is this that you can fetch records using “tricky ways” which normally may not be possible with straight…