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
0
votes
1 answer

Cake PHP: Containable Behavior or Model Unbind - which is good for Optimizing Query in Cake PHP

I'm working on a project based on Cake PHP.On that project recursive = 2 is used and that makes the application slow. Now I need To Optimize Some Query for slow response. For optimizing Query I can Follow two steps: 1. UnbindModel 2. Containable…
Asfaq Tamim
  • 5,677
  • 5
  • 22
  • 29
0
votes
3 answers

CakePHP don't include records whose contained model is empty

So my current paginate settings look like this: public $paginate = array( 'limit' => 30, 'contain' => array( 'Model1' => array( 'fields' => array('id') ), …
Oliver
  • 3,981
  • 2
  • 21
  • 35
0
votes
1 answer

CakePHP: Cannot use modParams with indexes that do not exist

I am writing a datasource to access a external web service, this works fine as expected, but after the web service has run, I get the following error: CakeException: Cannot use modParams with indexes that do not exist. in…
Anil
  • 21,730
  • 9
  • 73
  • 100
0
votes
2 answers

Show the user's username in post view w/ related comment

I am a newbie in CakePHP 1.3... I want to display or show the USER's username instead of USER's id, who post the COMMENTS in the POST view... Anyone can help me please? Here is the model association I made: POSTS 'has many' COMMENTS COMMENTS…
Azure
  • 3
  • 2
0
votes
1 answer

CakePHP 2.4.4 How can I structure this find() with Containable?

Tables User(id) Profile(id, *user_id*, type) Attribute(id, *attribute_name_id*, value) AttributeName(id, name) ProfileAttribute(id, *profile_id*, *attribute_id*) Relationships The relationships are set up correctly (and go both ways,…
StringsOnFire
  • 2,726
  • 5
  • 28
  • 50
0
votes
1 answer

Cakephp Containable not working at all

I have been banging my head on the wall over this. I have a model Sku that belongs to model Purchase. My AppModel has $actAs=array('Containable') and $recursive=-1 Inside SkuController, when I do $this->Sku->find('all', array('contain' =>…
vikc
  • 65
  • 1
  • 7
0
votes
1 answer

how to use cakePHP's containable when the key is $slug

I have a gallery model that has many photos, and in my gallery view I'm finding the gallery by $slug. I'm displaying all the photos that belong to a specific gallery_id. This is working as expected. However, I'd like to add a condition to the query…
Paul
  • 237
  • 5
  • 24
0
votes
1 answer

Attempt to replace CakePHP model binds with Containable is not working

I am trying to get a list of all Visitors with only the latest visit information and the associated VisitType description for an API call and I need to be able to do this in one find. Previously we had the second code block below, but this returns…
Omnilord
  • 844
  • 2
  • 16
  • 23
0
votes
2 answers

Containable to do show deeper data or join table

I have 3 tables: projects, project_reminder_users, project_types. The relations is as follow: Project => belong to => ProjectType hasMany => ProjectReminderUser ProjectReminderUser => belong to => Project ProjectType => hasMany =>…
Harts
  • 4,023
  • 9
  • 54
  • 93
0
votes
1 answer

HABTM related records not being filtered by conditions when using containable

Model1 HABTM Model2. In Model1's model class, I have the following code: public class Model1 extends AppModel { function getResult() { $this->contain('Model2', array( 'conditions' => array('Model2.name' => 'foo') …
mattalxndr
  • 9,143
  • 8
  • 56
  • 87
0
votes
1 answer

Cakephp2 Contain Deeper Association

I need to paginate a table where the I need to see only a project assigned to me, how can I achieve this? What I have is this //My Task Pagination $this->paginate = array( 'Project' => array( 'limit' => $limit, 'contain' =>…
Harts
  • 4,023
  • 9
  • 54
  • 93
0
votes
1 answer

Missing Behavior in cakephp

I need your help I'm developing a website using CakePHP in localhost, but when i trying to upload to server i get this error Missing Behavior Error: containableBehavior could not be found. Error: Create the class containableBehavior below in…
0
votes
1 answer

display data in view/index fetched by using containble behviour?

I have used containable behaviour in my code and it is working also. when I write print_r it is showing me an array as expected but problem is how i display that data in view/index page Here is my…
jessica
  • 11
  • 1
  • 6
0
votes
1 answer

Use of containble behaviour in cakephp?

I am having three tables category, subcategory and subsubcategory. Now category table contain fields as id,name subcategory table contain fields as id, category_id and name and subsubcategory table contain fields as id, subcategory_id and name now…
jessica
  • 11
  • 1
  • 6
0
votes
0 answers

CakePHP Containable with Fat Model, Skinny Controller

I'm trying to use Containable in CakePHP with a rather odd scenario. Group hasAndBelongsToMany User Group belongsTo User User hasAndBelongsToMany Group I'm uncertain, but either I've got something wrong in my query, or I'm thinking that perhaps…
BrendonKoz
  • 463
  • 1
  • 6
  • 18