I'm using the Containable behavior to get a list of Comments (belongsTo Post, which belongs to Question; Question hasMany Post, and Post hasMany Comments; all of these belong to Users).
$data = $this->Question->find ( 'first',
array ('contain' =>
array ('User',
'Post' => array ('User', /* 'order' => 'User.c...
When using CakePhp would it be advisable to set recursive = -1 in the AppModel class and then use the Containable Behaviour whenever you need a deeper data relationship?
I believe this would give my applications the best chance of avoiding database related sluggish performance but is the methodology sound?
Thanks
Leo
...
I have a model structure: Category hasMany Product hasMany Stockitem belongsTo Warehouse, Manufacturer.
I fetch data with this code, using containable to be able to filter deeper in the associated models:
$this->Category->find('all', array(
'conditions' => array('Category.id' => $category_id),
'contain' => array(
...
An example:
$this->Parent->Behaviors->attach('Containable');
$parent = $this->Parent->find('first', array(
'contain' => array('Child' => array(
'order' => 'Child.order ASC',
)),
)
);
Child has translated data and parent isn't using translatable. When I fetch the child data this way it'...
I have a few tables with the following relationships:
Company hasMany Jobs, Employees, and Trucks, Users
I've got all my foreign keys set up properly, along with the tables' Models, Controllers, and Views.
Originally, the Jobs table had a boolean field called "assigned". The following find operation (from the JobsController) successf...
Hi,
I use CakePHP 1.2.6 and have the following relations:
Showcase HABTM User belongsTo Galleryitem hasOne Image
I try to get all the data related to a Showcase, and therefor also all its users with their Galleryitem -> Image. I use the following query:
$showcase = $this->Showcase->find('first',
array('conditions'=>array('Showcase...
Hi,
I have developed a cake php application.
In this there are tables like students,placements,batches,companies
In placements table there is student_id,company_id and in students table there is batch_id column.
In placements index page i have applied jq grid. Here is the screen shot.
I want to give searching on student,company and...
(CakePHP Version 1.3.4)
I have the following association between a Contact model with Account and Test models:
class Contact extends AppModel {
var $name = 'Contact';
var $actsAs = array('Containable');
var $hasMany = array(
'Test' => array(
'className' => 'Test',
'foreignKey' => 'contact_i...