Re: Model associations problem

2010-06-17 Thread Jeremy Burns | Class Outfit
The results are perfectly correct for the code you are running; you are finding all Trackers. Your code: $this->set('trackers', $this->User->Tracker->find('all')); ... is saying "go to the User model, then leap out to the Tracker model and bring me back all Trackers". To filter the search, pa

Model associations problem

2010-06-17 Thread ryanl
I'm in the process of creating my first web application with CakePHP, however I've run into some problems. I'll just start with the code: class User extends AppModel { public $name = 'User'; public $belongsTo = 'Group'; public $hasMany = array( 'Tracker' =>

Model associations problem

2009-09-21 Thread Aivaras
Hey folks, There is this problem I am facing at the moment. Not sure how to solve it. So, my Gallery var $hasOne = array( 'MainPhoto' => array( 'className' => 'Upload', 'foreignKey' => false, 'fields' => array('MainPhoto.filename'),

Associations Problem

2007-11-06 Thread cronet
Hi, I have a tricky Associationsproblem: The Data is retrieved by an XML Request and Stored locally. For that i wrote a console shell script which works fine at this time. Following DB Structure: CREATE TABLE `hotel_types` ( `id` int(11) NOT NULL auto_increment, `hoteltype_id` int(255) NOT

Re: Model associations problem

2007-08-07 Thread Luiz Paulo Nascimento
Did you already try 'conditions' => 'users.deleted = "0"' ? The real table name is 'users', not 'User'... [ ]'s LP 2007/8/5, Ruud Gâst <[EMAIL PROTECTED]>: > > Hello there, > > I've got a simple construction of two models: users and familymembers; > every user belongs to a familymember and a fa

Re: Model associations problem

2007-08-07 Thread Ruud Gâst
Well, the condition is not included in the SQL. So that is why I'm not getting any errors when I create a condition that should create an error... I have removed all files in app/tmp/cache/models, if that is the right way to clear the model caches then I have. If not, how can I do that? Thanks f

Re: Model associations problem

2007-08-06 Thread John David Anderson (_psychic_)
On Aug 6, 2007, at 4:49 PM, Ruud Gâst wrote: > > No-one has an answer? I'd say a lot of people use the same > construction so it won't be that hard ... I just don't know how. What happens when you turn DEBUG up to 2 or so? Does the SQL include the condition? Have you tried clearing the model

Re: Model associations problem

2007-08-06 Thread Ruud Gâst
No-one has an answer? I'd say a lot of people use the same construction so it won't be that hard ... I just don't know how. On Aug 6, 3:01 am, Ruud Gâst <[EMAIL PROTECTED]> wrote: > Hello there, > > I've got a simple construction of two models: users and familymembers; > every user belongs to a f

Model associations problem

2007-08-05 Thread Ruud Gâst
Hello there, I've got a simple construction of two models: users and familymembers; every user belongs to a familymember and a familymember has one user. So the database looks like this: `familymembers` ( `id` int(11) auto_increment, `firstname` varchar(20), `lastname` varchar(100), `gen

Re: associations problem

2006-12-04 Thread Jon Bennett
Hi, > thanks, it works. had to use: > $this->User->unbindModel(array('hasMany'=>array('Article'))); > > in Article model. cool, though you could also unbind the (any) association from within your controller, in this case you have ArticlesController, which means you can access User as a child of

Re: associations problem

2006-12-04 Thread Claudio Poli 
thanks, it works. had to use: $this->User->unbindModel(array('hasMany'=>array('Article'))); in Article model. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to

Re: associations problem

2006-12-04 Thread Jon Bennett
> I've some association explained here, and they works pretty well. > However I want to be able to fetch a User's Profile when querying > Article model. it should be available, like so: $data['Article']['User']['Profile'] if you're also getting every article that a user has made, then yes I'd u

associations problem

2006-12-04 Thread Claudio Poli 
hi guys, I've some association explained here, and they works pretty well. However I want to be able to fetch a User's Profile when querying Article model. I've tried with recursion, but it will just fetch every article that belongsTo this User, and this is not what I want. Should I work with bin

Re: Interesting complex associations problem

2006-04-07 Thread josh southern
Nate, this appeared to work until I got to the show() action, which lists all the Menus. There are over 300 menus in the table, and when Cake tries to find all the product data for each of the 34 product fields for each of the 300 menus, it chokes. It can't complete the request. I get a server err

Re: Interesting complex associations problem

2006-04-07 Thread josh southern
Thanks, Nate. You've been my saving grace on this project! I ended up having to put almost all 34 in separate manual find() actions, because of recursion I needed on other associations in the Menu class, but it eventually worked! --~--~-~--~~~---~--~~ You receive

Re: Interesting complex associations problem

2006-04-06 Thread nate
Wow, that's a tough one. The only thing I can think of is removing three or four associations from $belongsTo, and doing them manually Menu::afterFind( ), which would look something like this (keep in mind, this code is off-the-cuff and completely untested): class Menu extends AppModel { /// ..

Interesting complex associations problem

2006-04-06 Thread josh southern
I have an app that is basically a menu of products. A user selects products in 34 drop-downs, and then it spits out a custom menu in PDF format. I have the associations set up as follows: ///Model 'Enhancement' (excerpt) var $hasMany = array( 'ProductOne' => ar

Re: Interesting hasMany associations problem

2006-04-06 Thread josh southern
I found it. Missed a semicolon in an unrelated association variable definition. Thanks for taking a look. This is actually a good example of how to do multiple associations between two models, for anyone browsing. It works great! --~--~-~--~~~---~--~~ You received

Re: Interesting hasMany associations problem

2006-04-06 Thread Mika
Hmm, I've just tried this in PhpEclipse which usually shows syntax errors and it's seems fine. Maybe your best bet is to start taking out each association until it works and they you will be able to find the error? --~--~-~--~~~---~--~~ You received this message b

Re: Interesting hasMany associations problem

2006-04-06 Thread Mika
The error should tell you what line the error is happening on. Check that line out. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To

Interesting hasMany associations problem

2006-04-05 Thread josh southern
I have an app I'm trying to convert to Cake, which basically spits out a menu of products. Therefore, the Menu class (and others) needs to hold many different products in several fields. I do not have a lookup table, because the app written procedurally (sp?) didn't need one. I've tried to set up