Questions tagged [containable]

Containable is a core CakePHP behaviour for filtering and limiting model find queries.

Containable is a core CakePHP behaviour for filtering and limiting model find queries. It works by binding and unbinding models on the fly, and results in a filtered, efficient result set that can cut down on memory and database resources.

View the official documentation on the Containable behaviour.

117 questions
1
vote
1 answer

CakePHP containable searches

I'm using Cake 2.3.8 and having a bit of trouble searching for data efficiently. I'm retrieving the data I'm looking for, but also a lot of stuff I don't need due to containables. For example Say I have the following tables table reservations id | …
user3476345
  • 331
  • 2
  • 6
  • 16
1
vote
2 answers

CakePHP containable not working

I have a "User" model in cakePHP associated with multiple other models. public $belongsTo = array( 'Reference' => array( 'className' => 'Reference', 'foreignKey' => 'reference_id', ), …
user2338772
  • 11
  • 1
  • 3
1
vote
0 answers

Cakephp Models not associating..Containable not working in live server

The project works fine with my local and dev server. But when uploading to live server, it seems to throw Model xxx is not associated with model ccc. The associations are working fine in both local and live servers. Even we uploaded the files twice…
1
vote
1 answer

cakephp dynamic virtualfield or apply beforeFind callback with containable

I'm currently attaching a virtual field in beforeFind() because I need to insert the current user's id into the query. Calling find on a related model and containing this model includes statically defined virtual fields but not the one in…
Devin Crossman
  • 7,454
  • 11
  • 64
  • 102
1
vote
1 answer

CakePHP conditions for deep associations

I have some deep associations using containable and need to filter back the results. For the sake of this question, let's say we are selling cars and want to narrow the results down by features. Car hasmany make hasmany model HABTM features $options…
1
vote
1 answer

CakePHP models not associating when using Containable

I am using below code but Cakephp get out error : "Model "Comment" is not associated with model "User"" $this->Paginator->settings = array( 'contain' => array_merge( array( 'Comment' => array( …
1
vote
2 answers

CakePHP: Warning (512): Model "User" is not associated with model "User" Windows to Ubuntu Deployment

I am trying to deploy a cakePHP app which works exactly as it should in Windows. I use an LdapUser model to authenticate through Active Directory: LdapUser:
SoulMagnet
  • 173
  • 1
  • 4
  • 18
1
vote
2 answers

CakePHP 1.3 contain not building associations correctly

this is my first question here. I'm having an issue with containable behavior in cakephp 1.3. The issue is as follows: I have a Deliverable model with the following associations: class Deliverable extends AppModel { var $name = 'Deliverable'; …
Andrew Senner
  • 2,479
  • 1
  • 18
  • 24
1
vote
0 answers

CakePHP FormHelper disagrees with data returned using Containable

I'm stuck with something fairly simple: SN hasMany NA. I retrieve data, with a condition on the contained NAs using $this->find('all',array( 'recursive' => -1, 'conditions' => array( 'SN.deleted IS NULL', …
Ruben
  • 3,452
  • 31
  • 47
1
vote
2 answers

CakePHP's Translate Behavior not working with Containable

I've implemented CakePHP's Translate Behavior, and all went fairly smooth, but I've now noticed that my translated data from the i18n table doesn't exist when I contain() a model that is supposed to be translated. Does the Translate Behavior not…
Dave
  • 28,833
  • 23
  • 113
  • 183
1
vote
1 answer

CakePHP 2.2.2 plugin pagination with containable

I am currently trying to use containable with $this->paginate() however I am unable to get the extra table in my result set. I am expecting to have MediaItem and MediaCollectionItem in the result set. Below is the controller code I have for my index…
adamias
  • 77
  • 11
1
vote
1 answer

Why isn't CakePHP using SQL joins

I'm fairly new to CakePHP, and have run into an issue that I can't seem to find a good solution for. My application has the following associations: Member hasMany Vote Roll hasMany Vote Vote belongsTo Member, Roll I'd like to retrieve all of the…
Fred Milton
  • 129
  • 1
  • 5
1
vote
1 answer

Cakephp nested contain

I have tree model with this structures and tables: Rate: id, model_name, object_id 1 , SocialPost, 12 public $belongsTo => array( 'SocialPost' => array( 'className' => 'Social.SocialPost', …
realman
  • 95
  • 5
1
vote
1 answer

CakePHP Containable on Assoicated Model

I have a setup where there are Books Users and Logs. Each Log has a Book and a User and I am trying to retrieve a list of all the books regardless of the user, but then also retrieve the Logs associated with that book (recursive is set to 1), but…
Bizarro181
  • 142
  • 1
  • 12
1
vote
2 answers

Deep Containable associations not working in cakephp 1.3.0

I have the following relationship in my models BasicIndexing belongsTo Applicant Applicant hasMany Request As such I would like to retreive the BasicIndexing model and contain the Applicant Model and an applicants corresponding request as shown in…
Compiler
  • 105
  • 10