Re: Model association problem - not getting expected array using $hasMany and $belongsTo association

2010-10-12 Thread cricket
Everything appears to be correct. Try deleting any files in app/tmp/cache/models/ if you haven't already. And set debug to 2, both so the models won't be cached and so you can see what queries are being run. On Mon, Oct 11, 2010 at 2:04 PM, Ashwani Kumar wrote: > Hi all! Today was trying to learn

Model association problem - not getting expected array using $hasMany and $belongsTo association

2010-10-11 Thread Ashwani Kumar
Hi all! Today was trying to learn associations but i couldn't succeed. I'm getting some issue in getting associated array. I've two tables : authors - id - name - email - website books - id - isbn - title - description - autho

Re: Association problem

2009-11-30 Thread un professional
Thanks for the help. I kept playing around with it and I realized I made the associations more complicated than I needed to. I removed the "join tables" (menu_item_types, menu_item_subtypes) and added the association: menu_item belongsTo(menu_type, menu_subtype). Doing a find('all') on MenuItem g

Re: Association problem

2009-11-29 Thread Dave
Try setting $this->recursive = 2. On Sun, Nov 29, 2009 at 5:04 AM, un professional < iamunprofessio...@gmail.com> wrote: > I am trying to make some associations with a restaurant menu. I have > five tables and they are all linked, although not directly. How do get > info from all tables if some t

Association problem

2009-11-29 Thread un professional
I am trying to make some associations with a restaurant menu. I have five tables and they are all linked, although not directly. How do get info from all tables if some tables aren't in direct relation to the "calling table"? Here is my setup: menu_items -id -name -price menu_types: ( has

Re: Model association problem

2009-07-17 Thread Zoran Kovac
Aargh...name conventions, still not used to it. Thanks for the heads up, knew it had to be something obvoius. It always is ;)) Now it works like a charm. -- Zoran Kovac 091/ 588 6175 V.Gorica On Fri, Jul 17, 2009 at 9:53 AM, Carlos Lavin wrote: > Tables are supposed to be plural (users,groups

Re: Model association problem

2009-07-17 Thread Carlos Lavin
Tables are supposed to be plural (users,groups,medicinal_devices) and the foreign keys singular(user_id,group_id...) Change it and give it another shot =) 2009/7/17 Zoran Kovac > Here are some of the table fields. it's the table USER, GROUPS and > MEDICIANL DEVICE. > In short relatons are: ser s

Re: Model association problem

2009-07-17 Thread leop
The database table names ought to be plural, viz: MEDICINAL_DEVICES, USERS etc. Cake is intelligent enough to handle plurals such as COMPANIES (COMPANY). In the model definitions, the model will be the capitalised singular version of the tablename, e.g. User Foreign keys are singular, e.g. user_

Re: Model association problem

2009-07-17 Thread Zoran Kovac
Here are some of the table fields. it's the table USER, GROUPS and MEDICIANL DEVICE. In short relatons are: ser should be in one group and have many MedDevice, group should have one user, medicinal device should have only one user. CREATE TABLE IF NOT EXISTS `baza2`.`USER` ( `id` INT NOT NULL

Re: Model association problem

2009-07-16 Thread Carlos Gonzalez Lavin
Maybe if you described the tables' fields.. theres gotta be some convention breaking there 2009/7/16 Zoran Kovac > > Hi! > > I'm having a dilema, maybe the better word is that I'm puzzled. > > The problem is when I'm baking models. The console doesn't detect > relations between tables automatica

Model association problem

2009-07-16 Thread Zoran Kovac
Hi! I'm having a dilema, maybe the better word is that I'm puzzled. The problem is when I'm baking models. The console doesn't detect relations between tables automatically. For instance, the console does recognize all the tables from the database, but when it's triying to detect associations it

Re: saveAll() and hasOne association problem

2009-02-23 Thread ramonmaruko
It works now. :) I removed the bind/unbindModel() calls and replaced them. http://bin.cakephp.org/view/38527196 ramonmaruko wrote: > Removing the bind/unbindModel() 'fixes' the problem. But I think I > need to have the bind/unbind since the member > may/may not have a spouse. > > On Feb 23, 6:25

Re: saveAll() and hasOne association problem

2009-02-23 Thread ramonmaruko
Removing the bind/unbindModel() 'fixes' the problem. But I think I need to have the bind/unbind since the member may/may not have a spouse. On Feb 23, 6:25 pm, ramonmaruko wrote: > What do I need to do so that saveAll() will automatically add the > correct member_id for this:http://bin.cakephp.o

saveAll() and hasOne association problem

2009-02-23 Thread ramonmaruko
What do I need to do so that saveAll() will automatically add the correct member_id for this: http://bin.cakephp.org/view/59481259 I have a EmergencyLoan hasOne Beneficiary which uses saveAll() that works perfectly. I can't seem to find what's wrong with the Member hasOne Spouse --~--~-~-

Auth -> User model association problem

2008-10-09 Thread Duncan
Hi, I have a User model, which belongsTo a Group model. When using the user model itself, I get the correct association data for the Group model, but when using the Auth component, then I only get the User model itself in the auth session array, e.g.: [Auth] => Array ( [User]

Re: Plugin Model Association Problem

2008-05-25 Thread biesbjerg
Add var $name = 'User'; & var $name = 'UserProfile'; as properties in your models and I think you're golden :-) On May 24, 10:19 am, francky06l <[EMAIL PROTECTED]> wrote: > Can you pass your model definition code ? > I have the same kind of plugin and not much problems, maybe I declare > the asso

Re: Plugin Model Association Problem

2008-05-24 Thread francky06l
Can you pass your model definition code ? I have the same kind of plugin and not much problems, maybe I declare the association in different way. I set the plugin name into the className parameter ie : belongTo => array('Profile' => array('className' => 'user.Profile') Wich cake version are

Re: Plugin Model Association Problem

2008-05-23 Thread Christopher E. Franklin, Sr.
On May 23, 2:49 pm, francky06l <[EMAIL PROTECTED]> wrote: > If the user model is in the plugin it should not a problem.. Maybe the > problem is how you call the find and from where ? I do the find in the UsersController::read() function. It seems to me that it is a problem with the association b

Re: Plugin Model Association Problem

2008-05-23 Thread francky06l
If the user model is in the plugin it should not a problem.. Maybe the problem is how you call the find and from where ? >The problem is when I try to find the user. In my model association I >have to have: I guess this is when you try to find user from the application and not the plugin ? Mayb

Plugin Model Association Problem

2008-05-23 Thread Christopher E. Franklin, Sr.
Hi great coders, I am having a problem trying to get my model associations in a plugin to come through. I have a plugin called users and I have a users_controller and a user_profiles_controller and thier associated models. Between these two models, I have them associated as, user has o

Multiple table association problem

2008-04-08 Thread Nick
I think I'm confusing myself. I've read several posts, but haven't got the right solution. I have a model called Properties that facilitates the addition, deletion, or editing of a property. Each property has 300 questions tied to it. These question answers (boolean true/false) are found in th

Re: Simple association problem

2007-06-22 Thread Mauro
Thank you all! the `s` wasn't there, it is true :( I hate when tthis happen Thanks --~--~-~--~~~---~--~~ 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

Re: Simple association problem

2007-06-22 Thread Joshua Benner
Perhaps try: var $belongsTo = array( (Note the 's' in there!) Mauro wrote: > Hi, > I am having some problems with belongTo, > here is my code: > > Model: > >class Document extends AppModel > { > > var $belongTo= array( > > 'Recorder' => >

Re: Simple association problem

2007-06-22 Thread soytuny
Maybe set DEBUG to 2 and look at the SQL being generated. Does $this->Document->findById(1) return the same thing? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send ema

Simple association problem

2007-06-22 Thread Mauro
Hi, I am having some problems with belongTo, here is my code: Model: array('className'=> 'Recorder', 'conditions' => '', 'order'=> '', 'dependent'=> true,

Model association problem

2007-05-22 Thread hashkash
Hi! Im in quite a fix. I have created 2 tables as of now users username,id,password,name,type(owner/incharge/both),email Primary key -> id equipment type,equipmentno,owner,incharge,dateofpurchase Primary key -> equipmentno Foreign Keys -> owner and incharge. The User hasMany Equipment.Equipment ca

Re: Association Problem

2007-02-17 Thread strykstaguy
sweet, THANK YOU! :) On Feb 17, 6:59 pm, "Grant Cox" <[EMAIL PROTECTED]> wrote: > Change your Intinerary's Event association to > > var $hasMany = array('Event' => array('className'=> 'Event') ); > > in your itineraries/view action, have something like > > function view($id) { > $this

Re: Association Problem

2007-02-17 Thread Grant Cox
Change your Intinerary's Event association to var $hasMany = array('Event' => array('className'=> 'Event') ); in your itineraries/view action, have something like function view($id) { $this->Itinerary->recursive = 1; $itinerary = $this->Itinerary->read(null, $id); $t

Association Problem

2007-02-16 Thread strykstaguy
I have tried to read the manual and look at examples but I am having a hard time with associations. For one, I have a three tables. Trips, Itineraries, Events Each has one Itinerary, Each Itinerary has many events. What i really want right now is to connect my Itineraries to Events, Currently w

Re: Association problem

2007-01-09 Thread John David Anderson (_psychic_)
On Jan 9, 2007, at 12:48 PM, Alessandro Nuzzo wrote: > > I have some problems to understand the association. > For example, I have a model 'User' and model 'Address'. > > User: > - id > - bla bla bla > - office_address : int -> address.id > - home_address : int -> address.id Stick this in y

Re: Association problem

2007-01-09 Thread Samuel DeVore
Here is an example from a project I have that is similar Model JobMaterial var $belongsTo = array( 'Client'=> array('className'=>'Client','foreignKey'=>'client_id'), 'Photographer' => array('className'=>'Client','foreign

Association problem

2007-01-09 Thread Alessandro Nuzzo
I have some problems to understand the association. For example, I have a model 'User' and model 'Address'. User: - id - bla bla bla - office_address : int -> address.id - home_address : int -> address.id How can I define association between this 2 models? Thanks a lot! --~--~-~--~