Re: self join and HABTM relation

2012-04-06 Thread Brian Bowler
What have you tried so far? On Fri, Apr 6, 2012 at 5:10 AM, Reza Talamkhani wrote: > Hi > I need to create a 'posts' table in db and show related posts to users... > need to self join and HABTM (hasAndBelongsToMany) relation... > please help me > > -- > Our newest site for the community: CakePHP

self join and HABTM relation

2012-04-06 Thread Reza Talamkhani
Hi I need to create a 'posts' table in db and show related posts to users... need to self join and HABTM (hasAndBelongsToMany) relation... please help me -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakep

Re: Error in define HABTM relation with 'joinTable' and with 'with'

2010-02-07 Thread Lorenzo Bettini
@gmail.com" wrote: Hi I'm working on a legacy system , i must to defina an HABTM relation between User and Group. In User model I have this: var $hasAndBelongsToMany=array( 'Group' =>array( 'className'

Re: Error in define HABTM relation with 'joinTable' and with 'with'

2010-02-03 Thread marco.rizze...@gmail.com
d table. > > I guess. > > cheers >         Lorenzo > > > > marco.rizze...@gmail.com wrote: > > Is there someone that can help me about this? > > > On 2 Feb, 19:02, "marco.rizze...@gmail.com" > > wrote: > >> Hi > >> I'm working

Re: Error in define HABTM relation with 'joinTable' and with 'with'

2010-02-03 Thread Lorenzo Bettini
right name for the used table. I guess. cheers Lorenzo marco.rizze...@gmail.com wrote: Is there someone that can help me about this? On 2 Feb, 19:02, "marco.rizze...@gmail.com" wrote: Hi I'm working on a legacy system , i must to defina an HABTM relation between Use

Re: Error in define HABTM relation with 'joinTable' and with 'with'

2010-02-03 Thread marco.rizze...@gmail.com
Is there someone that can help me about this? On 2 Feb, 19:02, "marco.rizze...@gmail.com" wrote: > Hi > I'm working on a legacy system , i must to defina an HABTM relation > between User and Group. In User model I have this: > >         var $hasAndBelongsToMany=a

Error in define HABTM relation with 'joinTable' and with 'with'

2010-02-02 Thread marco.rizze...@gmail.com
Hi I'm working on a legacy system , i must to defina an HABTM relation between User and Group. In User model I have this: var $hasAndBelongsToMany=array( 'Group' =>array( 'className'=> 'Group&

HABTM relation

2009-10-14 Thread Benedikt R.
Hi! If i want to add a record to TABLE A, is there an efficient way to add a record in the JOIN TABLE for many (or all) records in TABLE B? I try to build a simple task management. An user adds a task and there will be added a connection to each other user in the same group as the current user.

Re: Specific HABTM relation

2009-09-25 Thread yellow
solution is here: articles_controller function add (or edit): ... foreach($this->data['Category']['Category'] as $num => $category){ $this->data['CategoriesModel'][$num]['model_id'] = $this->data ['Article']['id'];

Re: Specific HABTM relation

2009-09-25 Thread yellow
I've found solution with binding models on the fly: articles_controller function add (and function edit) ... foreach($this->data['Category']['Category'] as $num => $category){ $this->data['CategoriesModel'][$num]['model_id'] = $this->data ['Article']['id']; $this->data['Categories

Specific HABTM relation

2009-09-25 Thread yellow
First some introduction... My implementation: Category HABTM Article and Article HABTM Category Category HABTM Gallery and Gallery HABTM Category Category HABTM Link and Link HABTM Category Category HABTM Document and Document HABTM Category ... Database table for joins: CREATE TABLE IF NOT EXI

Re: HABTM relation with custom named table

2009-05-15 Thread MPeg
t; > Model "Yuser" -> Table "freyr_users" > Model "Ypermission" -> Table "freyr_permissions" > > I built a join_table like: > > Table name: "freyr_objects_permissions" > object_id | bigint (16) > permission_id | bigint (16) &

HABTM relation with custom named table

2009-05-12 Thread MPeg
uot; Model "Ypermission" -> Table "freyr_permissions" I built a join_table like: Table name: "freyr_objects_permissions" object_id | bigint (16) permission_id | bigint (16) I have set up my "Yuser <-> YPermission" HABTM relation this way: var $hasAn

Re: HABTM relation on same model - cake doesn't save other fields now?!

2008-12-11 Thread miller218
I've just checked the content of the $this->data variable which is saved by the edit function in the controller.. It contains all changes!! but somehow the $this->DictWord->save($this->data) function just saves the HABTM relation and ignores the other fields! Any ideas? --

HABTM relation on same model - cake doesn't save other fields now?!

2008-12-10 Thread miller218
ction, e.g. if you view the word "cake", there should be a field named "see also" that refers to "baker", "recipe",.. I hope you see what I mean) So here's what I've done: - created a database table called "dict_words_dict_words" with t

Re: HABTM confusion was: How to add item using HABTM relation

2008-12-04 Thread Rob
']['user_id']; > > >                    $this->User->UserSlot->create(); > > >                    if ($this->User->UserSlot->save($this->data > > ['UserSlot'])) { > >                        $user_slot_id = $this->User->Use

HABTM confusion was: How to add item using HABTM relation

2008-12-04 Thread Zeugme
stInsertId(); > > > Basically I create the user, get the user ID, set the UserSlot's > user_id, and save the UserSlot ... > > So as long as you set the data for the HATBM id's correctly, the rows > will be created. > > On Dec 3, 9:57 am, Zeugme <[EMAIL PROTECTE

Re: How to add item using HABTM relation

2008-12-03 Thread Rob
the user ID, set the UserSlot's user_id, and save the UserSlot ... So as long as you set the data for the HATBM id's correctly, the rows will be created. On Dec 3, 9:57 am, Zeugme <[EMAIL PROTECTED]> wrote: > Hi, > > How to add an item to a HABTM relation ? > > I have

How to add item using HABTM relation

2008-12-03 Thread Zeugme
Hi, How to add an item to a HABTM relation ? I have a Person and I have to add a Contract to that person. Here are the data on a view : data[Contract][type] : 12 data[Contract][name] : contract-AAaa data[Contract][Person] : 26 // Should I put the person id here ?? or something else ?? In

Re: Saving data in HABTM relation ship

2008-12-01 Thread Rob
7; ), 'EntityType' => array( 'className' => 'EntityType', 'joinTable' => 'entities_tags', 'foreignKey' => 'entity_id', 'associationForeignKey

Saving data in HABTM relation ship

2008-12-01 Thread bookme
Hi, I have a problem to saving data in HABTM relation ship. 1) tags : tag_id, tag_name . 2) entity_types : entity_type_id, entity_type_name . [(0, Posts), 3) teachers : teacher_id, teacher_name . 4) entities_tags : tag_id, entity_type_id, entity_id . I am using HABTM relation ship between

HABTM relation without jointable

2008-05-12 Thread [EMAIL PROTECTED]
HI I have a HABTM relation between two model that it's defined by a finderQuery and It hasn't a jointable. But i get always an error from cake 1.2 that the join table misses. In cake 1.13 all works perfectly. How can I do? --~--~-~--~~~---~--~~ You rec

Limiting HABTM relation to MPTT children

2008-04-15 Thread boyracerr
Hi, I have two models, Users and Groups. I want to represent the association Users have Groups. Easy enough HABTM. However, Groups are using Tree behavior, and I would like to specify that only Groups below a certain level are returned. The ways I have come up with to do this are not particular

Re: HABTM Relation with foreign key

2008-03-26 Thread Guillaume Chomat
Hi boyracerr, Thanks for your help. Cake is effectively amazing!!! Kind Regards. On Mar 26, 4:10 am, boyracerr <[EMAIL PROTECTED]> wrote: > Me again, > > As so often, I knew I wanted to use it but needed a helpful post > laying it out for me in simple terms. Mariano to the rescue! > > http://w

Re: HABTM Relation with foreign key

2008-03-25 Thread boyracerr
Me again, As so often, I knew I wanted to use it but needed a helpful post laying it out for me in simple terms. Mariano to the rescue! http://www.cricava.com/blogs/index.php?blog=6&title=modelizing_habtm_join_tables_in_cakephp_&more=1&c=1&tb=1&pb=1 If you are using 1.2, then just set the table

Re: HABTM Relation with foreign key

2008-03-25 Thread boyracerr
As so often, stating my problem helped me think of it in a different way (actually it gave me different phrases to Google for) Have a look at: http://www.thinkingphp.org/2006/10/26/modeling-relationships-in-cakephp-faking-rails-throughassociation/ I think this is what we are both trying to do.

Re: HABTM Relation with foreign key

2008-03-25 Thread boyracerr
Hi, sorry for jumping in your post, but I think my situation is almost exactly the same. Imagine I have a forum application with many forums, so that we have Users Forums A user may be an admin for one forum, a member of another, a moderator of another. There is a table for Roles. What is the

Re: HABTM Relation with foreign key

2008-03-25 Thread Guillaume Chomat
Hi logica, Don't focus on the cohérence of the sample used to explain my needs. It is just a weird example. What i need is to know if it is possible when defining a HABTM relationship to tell cake to resolve also the foreign key contained in the join table. Can you help me on this? Thanks in ad

Re: HABTM Relation with foreign key

2008-03-25 Thread b logica
I suspect that you'd be far better off with role_id in the users table. Unless it denotes a particular role (among many) that a user had when making the post. users belongsTo roles, HABTM posts posts HABTM users posts_users (user_id, post_id) On Tue, Mar 25, 2008 at 5:35 AM, Guillaume Chomat <

HABTM Relation with foreign key

2008-03-25 Thread Guillaume Chomat
Hi everybody, Is cake able to read any referenced model in a join table? Suppose we have three entities table: - users - posts - roles and a join table: - posts_users. The join table posts_users has a field role_id, foreign key to the roles table. We have defined the HABTM relationship in the

Re: Some newbie questions part 1: showing form for a habtm relation

2007-12-03 Thread Adam Royle
work the way you want. Cheers, Adam On Dec 1, 8:36 am, Bram <[EMAIL PROTECTED]> wrote: > Hi all, > > I'm baking my first CakePHP project at the moment and I've some newbie > questions. I'll ask each question in it's own topic. > > First of all, I'v

Some newbie questions part 1: showing form for a habtm relation

2007-11-30 Thread Bram
Hi all, I'm baking my first CakePHP project at the moment and I've some newbie questions. I'll ask each question in it's own topic. First of all, I've a model with an habtm relation, let's call this model Company. The related model is called Specialty. I would like