HABTM question, really appreciate any help!

2011-02-03 Thread Tan Cheng
I'm a newbie to Cakephp and I am trying to learn the HABTM for the post and tag example. I have set up the $hasAndBelongToMany to both post and tag models, also I have created the posts_tags join table. I added the $scaffold in the posts and tags controller, when I try to add a new post, the tags

difficult saveAll HABTM question

2011-02-02 Thread Celso
***Equipamento*** hasBelongToMany ***Recibo*** ***EntradaEquipamento*** belongsTo ***Recibo***, ***Equipamento*** In the Equipamento/add view, i have various Equipamento.n.fields, and for each Equipamento, i need save a EntradaEquipamento too I tried this array in saveAll, but without success:

HABTM question

2010-12-08 Thread Jens Dittrich
Hello, I have the following situation in which i need help: There are people, roles and lectures, summer_schools and presentations. People HABTM roles. Depending on their role people are associated to lectures or summer_schools or presentations. So I am planning on creating more HABTM-tables

Re: HABTM question

2010-12-08 Thread huoxito
I believe people_roles_summer_schools wouldn't be a nice table name for a cakephp app. I once tried to bake something like that and it didnt work, instead I used a single name for a table which has many foreign keys. On 8 dez, 07:42, Jens Dittrich jdittr...@googlemail.com wrote: Hello, I

Re: HABTM question

2010-12-08 Thread cricket
On Wed, Dec 8, 2010 at 5:42 AM, Jens Dittrich jdittr...@googlemail.com wrote: Hello, I have the following situation in which i need help: There are people, roles and lectures, summer_schools and presentations. People HABTM roles. Depending on their role people are associated to lectures or

Another HABTM question

2010-10-15 Thread brybot
I've searched and looked through this group and the online documentation for hours, but I'm having some difficulty with a simple problem. Its a simple setup: User HABTM Permissions Everything is setup properly (3 tables: users, users_permissions, permissions). And everything works fine, I'm

Re: Another HABTM question

2010-10-15 Thread Jeremy Burns | Class Outfit
The join table has to be in alphabetical order, so try permissions_users. Jeremy Burns Class Outfit jeremybu...@classoutfit.com http://www.classoutfit.com On 15 Oct 2010, at 07:39, brybot wrote: I've searched and looked through this group and the online documentation for hours, but I'm

Re: Another HABTM question

2010-10-15 Thread cricket
On Fri, Oct 15, 2010 at 2:39 AM, brybot br...@bryanrite.com wrote: I've searched and looked through this group and the online documentation for hours, but I'm having some difficulty with a simple problem. Its a simple setup: User HABTM Permissions Everything is setup properly (3 tables:

HABTM Question.

2010-05-28 Thread Roland Pish
Hi! I've been struggling for a long time with something and I don't seem to get it. I did the Posts/Tags HABTM Select example from this page: http://mrphp.com.au/code/working-habtm-form-data-cakephp So far so good, everything works ok. I wanted to try the same example but asumming that the

Re: HABTM Question.

2010-05-28 Thread Jeremy Burns
I am *guessing* that your variable that contains your funny_tags is not being set correctly. It is set here: $tags = $this-Post-Tag-find('list',array('fields'=array('id','name'))); ...so change that to: $funny_tags = $this-Post-FunnyTag-find('list',array('fields'=array('id','name'))); ...and

Re: HABTM Question.

2010-05-28 Thread Roland Pish
Thanks Jeremy. In fact I did that and didn't solve the problem. I'm still trying but with no success yet. Regards. On 28 mayo, 21:24, Jeremy Burns jeremybu...@me.com wrote: I am *guessing* that your variable that contains your funny_tags is not being set correctly. It is set here: $tags =

Re: HABTM Question.

2010-05-28 Thread Roland Pish
I think I'll post the code and information here. I still don't know what is happening. Any help is hugely appreciated. The tables: funny_tags: id,name funny_tags_posts: id,funny_tag_id,post_id posts: id,name,body The files: + Under models: post.php and funny_tag.php + Under controllers:

Re: HABTM Question.

2010-05-28 Thread Jeremy Burns
Ah. Try this: $funnyTags = $this-Post-FunnyTag-find('list',array('fields'=array('id','name'))); If that doesn't fix it, try this as well: echo $form-input('FunnyTag'); Jeremy Burns jeremybu...@me.com On 29 May 2010, at 05:46, Roland Pish wrote: I think I'll post the code and information

Re: HABTM Question.

2010-05-28 Thread Roland Pish
Thanks, We are getting closer!! After using $funnyTags now the select is populated correctly but the funny tags aren't selected according to what is on the database. I tried this: echo $form-input('FunnyTag'); but the funny tags aren't still selected. On 28 mayo, 22:51, Jeremy Burns

Re: HABTM Question.

2010-05-28 Thread Roland Pish
It worked!! Finally!! There was something weird in the database. I submitted the form and magically the select was populated and funny tags were selected. I really appreciate your help Jeremy. One last question, where is in cake manual the convention you advised to fix this (the use of

Re: HABTM Question.

2010-05-28 Thread Jeremy Burns
It isn't just restricted to HABTM, it's a standard thing. But here's a page that refers specifically to HABTM: http://book.cakephp.org/view/1390/Automagic-Form-Elements Jeremy Burns jeremybu...@me.com On 29 May 2010, at 06:10, Roland Pish wrote: It worked!! Finally!! There was something

Re: HABTM Question.

2010-05-28 Thread Roland Pish
Thanks Jeremy! In the link you supplied, after reading the portion ...(group - groups in this case, or ExtraFunkyModel - extraFunkyModels).. now it all makes sense. Regards. On 28 mayo, 23:13, Jeremy Burns jeremybu...@me.com wrote: It isn't just restricted to HABTM, it's a standard thing. But

Another HABTM question with checkboxes

2010-01-22 Thread Binu
Hi, I have a table structure like this admins tablehabtm rights table belongs to rights_groups In view I need to print like this as checkbox Rights_group Name1 Rights1 Rights2 Rights_group Name2 Rights3 Rights4 View code (Since I have to give the group name, I need

HABTM Question

2010-01-03 Thread Dave
I am back to working with additional fields in a HABTM and going to try the method as described in the cookbook. Child hasMany Membership Membership belongsTo Child, Club Club hasMany Membership. In my setup I have User, Skill, Year, Skillset and UsersSkill but not sure of setting up the

Re: HABTM question - keeping associated records in a specific order

2009-06-03 Thread Hiero
Had an informative discussion on this at Stack Overflow: http://stackoverflow.com/questions/936203/storing-sort-order-for-items-held-in-an-habtm-association-cakephp On Jun 1, 9:31 pm, Hiero v25me...@gmail.com wrote: I have a HasAndBelongsToMany association setup on Videos and Bins: A Bin can

HABTM question - keeping associated records in a specific order

2009-06-01 Thread Hiero
I have a HasAndBelongsToMany association setup on Videos and Bins: A Bin can store n references to Videos, and Videos can belong to n Bins. I need to be able to manually set and store the display order of the Videos within a particular Bin (so the client can have his Videos in a particular order

Re: HABTM question

2009-05-05 Thread John Andersen
Hi Dave, In my opinion, you should only have one HABTM table between the USER and SYSTEM models. If you need to split your information from the SYSTEM model into separate presentation steps, do it with views or with additional tables/models. Example: Users --- systems_users --- Systems ---

RE: HABTM question

2009-05-05 Thread Dave Maharaj :: WidePixels.com
Cool... Will just leave it the way it is. Thanks. Dave -Original Message- From: John Andersen [mailto:j.andersen...@gmail.com] Sent: May-05-09 5:57 AM To: CakePHP Subject: Re: HABTM question Hi Dave, In my opinion, you should only have one HABTM table between the USER and SYSTEM

HABTM question

2009-05-04 Thread Dave Maharaj :: WidePixels.com
I have a question about if this is possible or if it even make sense to do. I have 4 HABTM tables that are for a USER to select options from. The options are only for choosing and user has no control over any of the actual options (edit delete add none of that) Now the tables look like this:

complex HABTM question

2009-04-09 Thread luke83
Hi there, first question, complex question :D i have tables in db like this: + leagues | - lid | - name + users | - uid | - name + groups | - gid | - name + league_staff | - lid | - gid | - uid The models: class League extends AppModel { var $name = 'League'; var $primaryKey =

Re: complex HABTM question

2009-04-09 Thread luke83
The problem is the attribute recursive: i cannot set it to 3 as i need! Is there a way to bypass the problem or a trick to have more deep association fatching? Thanks! On 9 Apr, 16:27, luke83 luc...@gmail.com wrote: Hi there, first question, complex question :D i have tables in db like this:

Re: complex HABTM question

2009-04-09 Thread Miles J
Use Containable over Recursion. http://book.cakephp.org/view/474/Containable --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To

HABTM question

2008-11-28 Thread Jerry
I've got a fairly good grasp on the HABTM concept/implementation, but would like to add a twist: Suppose we have users and movies tables. A user can select 'favorites' from the movies table, as many as he/she wishes. So the movies_users table would have an ID, a movie and a user field. Now

HABTM question. Containable behavior?

2008-06-12 Thread slaphappy
This is how my database structure looks: Categories HABTM Authors I have a join table Authors_Categories Authors HasMany Articles I want to retrieve all Articles that are in a Category based on the association with Authors. Would I use the Containable behavior for this, and if so, what

General HABTM question

2008-02-23 Thread jim starboard
Despite the naming convention, isn't the HABTM association really just modeling the shared foreign key table relationship? For example, you have a 'users' table and an 'items' table, and they are tied together with the items_users table. Not considering cake, you would use this because several

Re: General HABTM question

2008-02-23 Thread rtconner
You got it right. --~--~-~--~~~---~--~~ 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 unsubscribe from this group, send email to [EMAIL PROTECTED] For

Re: General HABTM question

2008-02-23 Thread jim starboard
thanks guv'ner On Feb 23, 10:48 pm, rtconner [EMAIL PROTECTED] wrote: You got it right. --~--~-~--~~~---~--~~ 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: HABTM question from newbie

2007-10-04 Thread dardosordi
I don't think that making a model for that join table cause you some trouble, anyway I see no use of it. On Oct 4, 12:26 am, Comida411 [EMAIL PROTECTED] wrote: Rt, Can you clarify... I mean the auto create feature is a convenience... right... The alternative is for me to create the model

HABTM question from newbie

2007-10-03 Thread Comida411
There appear to be 3 types of join table in my data model.. 1. Pure join - table comprised of two or more foreign keys only and no other attribues (column headers) 2. Join as parent - table comprised of two or more foreign keys only and no other attribues... wherein he table is also the parent

Re: HABTM question from newbie

2007-10-03 Thread rtconner
Sure why not. Cake 1.2 has recenlty added a feature where you can speficy a 'With' association which auto-creates a model for the join table. You may want to mess around with that. An example can be found in the OCPHP doc found here: http://cakephp.org/downloads On Oct 3, 8:25 am, Comida411

Re: HABTM question from newbie

2007-10-03 Thread Comida411
Rt, Can you clarify... I mean the auto create feature is a convenience... right... The alternative is for me to create the model manually Is it bad practice to create models for joins tables comprised soley of two foreign keys.. Is that just a bad idea in general? Thank you for your time T

Re: HABTM Question

2007-06-30 Thread Joshua Benner
You can pass conditions to generateList. Take a look at the api http://api.cakephp.org. Ketan Patel wrote: Say we have a posts and tags table and the HABTM association has been set with posts_tags as the join_table. I am able to save the tags to the database. My problem is I know which posts

HABTM Question

2007-06-29 Thread Ketan Patel
Say we have a posts and tags table and the HABTM association has been set with posts_tags as the join_table. I am able to save the tags to the database. My problem is I know which posts belong to which user through the posts table posts: - id, user_id, title, details tags: -- id, name

HABTM question

2007-01-21 Thread c46
Hi, I'm a newbie at this, and have spent many hours searching and reading this group. Some answers I found, but some still elude me. I have the following associations: Show hasAndBelongsToMany Artist Artist hasAndBelongsToMany Show When I 'view' a Show, I can see all the info and also the

Re: HABTM question

2007-01-21 Thread c46
Thanks! I don't know what I was thinking!!! I did set to recursive = 2, but only in a different method and somehow didn't see that it was missing from the one used here... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

Re: Simple HABTM Question

2006-05-26 Thread AD7six
Hi Dee, The - Just reverences a Variable or method on an object (if it has () it't a method). In the example above, contractor has a variable Servic, which is set to a Service object. It the chain of object could be avoided by using: var $uses (Contractor,Service);

Re: Simple HABTM Question

2006-05-24 Thread Dee
AD7six, Thanks for this post! I ran into the same problem as brandags. I have a question though. Yes this does work, but why does it work? I thought the arrow (-) referenced a member of the class like a method or member. Is that right? If so how did Service become a member of Contractor?

Re: Simple HABTM Question

2006-04-25 Thread AD7six
Hi Brendon, Try something like this: // What do I need to put here to return all the contractors linked to $service_id? $result = $this-Contractors-Services-FindByID($service_id); if ($result) { foreach ($result['Contractor'] as $Contractor) { $data[] = Array('Contractor'=$Contractor); }

Re: Simple HABTM Question

2006-04-25 Thread brandags
I get a very strange result when I do that. I did have to singularize the Model names as well: $result = $this-Contractor-Service-findByID($service_id); SQL Error in model Service: 1054: Unknown column 'Service.i_d' in 'where clause' The query that's run is this: SELECT `Service`.`id`,

Re: Simple HABTM Question

2006-04-25 Thread AD7six
There´s a reason I wrote something like :). I use code very similar to this, but I wrote it here off the top of my head. Try: $result = $this-Contractor-Service-findById($service_id); Note the lowercase D, I don`t know if that's the reason for the underscore, but it could be. Cheers, AD7six

Re: Simple HABTM Question

2006-04-25 Thread brandags
Ha! What do you know - that was it! Thank you! --~--~-~--~~~---~--~~ 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 unsubscribe from this group, send