$hasAndBelongsToMany Problems

2015-10-06 Thread Daniel Gray
Good Day I am still very very new to CakePHP and I have gained tons of respect for it, but I having a problem with $hasAndBelongsToMany . The issue I am having is the echo $this->Form->input('TypesGames'); Displays nothing but an input empty Box, <https://lh3.googleu

help me to join the table with associative table using hasAndBelongsToMany

2014-03-20 Thread REnu Varghese
> Business and Category tables are related with business_categories table I got the correct result of all Business based on Category my model page Category.php is here pasting $this->bindModel( array( 'hasAndBelongsToMany' => array( 'Business' => array( '

join tables with associated table using hasAndBelongsToMany

2014-03-20 Thread REnu Varghese
> Business and Category tables are related with business_categories table I got the correct result of all Business based on Category my model page Category.php is here pasting $this->bindModel( array( 'hasAndBelongsToMany' => array( 'Business' => array( '

Re: Error on find on hasAndBelongsToMany relationed models

2013-04-26 Thread Saran Pal
.html#hasandbelongstomany-habtm Cheers!.. Saran On Thu, Apr 25, 2013 at 5:49 PM, Reuben wrote: > The HABTM generally doesn't do a join. You would only use a straight find > when you have conditions for only one of the models. > > Alternatives are to use contains, or use joi

Re: Error on find on hasAndBelongsToMany relationed models

2013-04-25 Thread Reuben
join clause, because it matches mostly closely with what I'd do, if I was writing straight SQL. Regards Reuben Helms On Thursday, 25 April 2013 02:47:31 UTC+10, Ciul wrote: > > I'm having troubles to restrict a find operation based on a related model > field within a hasAndBe

Error on find on hasAndBelongsToMany relationed models

2013-04-24 Thread Ciul
I'm having troubles to restrict a find operation based on a related model field within a hasAndBelongsToMany relationship. *// Wedding Model* *public $hasAndBelongsToMany = array('Guest');* * * *// Guest Model* *public $hasAndBelongsToMany = array('Wedding');* *

CakePHP hasAndBelongsToMany relationships demystified

2012-07-29 Thread Ralf Rottmann
You might find this helpful: http://www.24100.net/2012/07/cakephp-hasandbelongstomany-relationship-queries-demystified/ . I'm addressing a couple of questions: - Scenario where a User and a Group model share a bidirectional hasAndBelongsToMany relationship. - Saving a user with

Re: hasAndBelongsToMany

2012-03-19 Thread pokerphp
Thank you much, it sounds like using paginator will do exactly what I need. Just starting with CakePHP (and MVC in general), so it all still seems more complicated for me than it actually is, thank you again :) On Tuesday, March 20, 2012 12:17:54 AM UTC+2, thatsgreat2345 wrote: > > I guess you c

Re: hasAndBelongsToMany

2012-03-19 Thread thatsgreat2345
I think that paginating your ingredients is overkill. How many would >> you ever have in a single recipe? >> >> If you're viewing a single Recipe, just list the associated >> Ingredients in the same view. Just loop through associated Ingredient >> array. &

Re: hasAndBelongsToMany

2012-03-19 Thread pokerphp
d > you ever have in a single recipe? > > If you're viewing a single Recipe, just list the associated > Ingredients in the same view. Just loop through associated Ingredient > array. > > On Mon, Mar 19, 2012 at 3:14 PM, pokerphp wrote: > > Hi, > > > > I hav

Re: hasAndBelongsToMany

2012-03-19 Thread lowpass
> Hi, > > I have Recipe hasAndBelongsToMany Ingredient. > > I want to be able to browse ingredients of the recipe using next/prev > navigation. > Should it be done in RecipesController, or the IngredientsController? > > The way i see it is, if I use ingredients/view to di

hasAndBelongsToMany

2012-03-19 Thread pokerphp
Hi, I have Recipe hasAndBelongsToMany Ingredient. I want to be able to browse ingredients of the recipe using next/prev navigation. Should it be done in RecipesController, or the IngredientsController? The way i see it is, if I use ingredients/view to display an ingredient, I have no way of

Re: hasAndBelongsToMany Question

2011-12-15 Thread AD7six
On Dec 13, 9:04 pm, Leon wrote: > Hello, > > So in my app I have Patients and I have Groups and each Patient can be > in many Groups and each group can have many patients. That's fine. > > I've got the multi-select setup on the View and that works fine too. > > However, I need to make some API c

Re: hasAndBelongsToMany Question

2011-12-15 Thread Toby G
Don't think that there's an easy way to do this, but if you have another unique value field in the table, you could use the solution mentioned here... http://cakephp.1045679.n5.nabble.com/saveall-and-getLastInsertId-or-return-all-last-inserted-ids-td1294886.html Perhaps create a field just to sto

Re: hasAndBelongsToMany Question

2011-12-13 Thread Ersin Demirtas
Do you mean you want to logging what action the user has taken then check http://book.cakephp.org/view/1194/Logging On Dec 13, 8:04 pm, Leon wrote: > Hello, > > So in my app I have Patients and I have Groups and each Patient can be > in many Groups and each group can have many patients. That's

hasAndBelongsToMany Question

2011-12-13 Thread Leon
Hello, So in my app I have Patients and I have Groups and each Patient can be in many Groups and each group can have many patients. That's fine. I've got the multi-select setup on the View and that works fine too. However, I need to make some API calls in my controller when a Patient is edited.

Re: Form input Automagic on hasAndBelongsToMany when the model is not the model for the form?

2011-12-01 Thread phpMagpie
Can you show us an echo debug of your data array? -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send ema

Re: Form input Automagic on hasAndBelongsToMany when the model is not the model for the form?

2011-11-30 Thread calzone
Also to clarfiy, I have dumped $this->data at the view load time and have verified that all the data needed for the automagic population is present. So the problem is not at the query level, but would appear to be at the Helper level. -- Our newest site for the community: CakePHP Video Tutori

Re: Form input Automagic on hasAndBelongsToMany when the model is not the model for the form?

2011-11-30 Thread calzone
Thank you for answering. I was afraid the association might be too deep. Just to clarify one thing, the model is not named Session, I was just trying to describe the nature of my problem using model names here that would make more sense to people not intimately familiar with the project. -- O

Re: Form input Automagic on hasAndBelongsToMany when the model is not the model for the form?

2011-11-30 Thread phpMagpie
That's a very deeply associated field, Cake is possibly struggling to complete the automagic that deep. You may struggle with a model called Session due to clash with the Session component. AFAIK, any ajax created or deleted fields will mess up the Security Hash as it's generated on page load,

Form input Automagic on hasAndBelongsToMany when the model is not the model for the form?

2011-11-29 Thread calzone
I have a model (let's called it Sessions) that hasAndBelongsToMany Tags. Each Session belongsTo a Track Each Track belongsTo an Event Each Event belongs to an EventGroup A User may manage several EventGroups. For UX purposes, I have condensed the maintenance of all these into one for

Re: How to paginate in HasAndBelongsToMany?(a liitle bit confused )

2011-11-26 Thread phpMagpie
You should find your answer by searching this group: https://groups.google.com/forum/#!searchin/cake-php/paginate$20habtm -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with the

How to paginate in HasAndBelongsToMany?(a liitle bit confused )

2011-11-25 Thread Richard Neil Roque
I do have a articles model and tags model. articles HABTM tags i use $this->set('articles', $this->Article->paginate()); and i can use paginator in index.ctp of Articles. I try to search articles by Tags, but the problem is it doesn't fit with the paginator. here's the code for showing of artic

Re: How to validate hasAndBelongsToMany multiple-select?

2011-11-21 Thread phpMagpie
If you're using the core 'multiple' validation rule then I was involved in many discussions about this some time back, the following search should provide all the reading you require: https://groups.google.com/forum/#!searchin/cake-php/validate$20multiple$20rule HTH, Paul. -- Our newest site f

How to validate hasAndBelongsToMany multiple-select?

2011-11-20 Thread Mattia Manzati
I all, I'm trying to use the "multiple" validation method, but it seems that it doesn't works... This is my model: https://gist.github.com/1380696 Thanks in advance for any help! ^^ -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Qu

Re: hasAndBelongsToMany does not work

2011-10-09 Thread Zaky Katalan-Ezra
Provide the models code On Fri, Oct 7, 2011 at 11:26 PM, khalili merouane < merouane.khal...@gmail.com> wrote: > Hello, > > I have two tables categories and products when I try to view a > category, I just have the information in the category without > products. > > When I check the applications

hasAndBelongsToMany does not work

2011-10-08 Thread khalili merouane
Hello, I have two tables categories and products when I try to view a category, I just have the information in the category without products. When I check the applications running I see that selects the products but does not display I have the join table categories_products and that the table qu

Re: Multiples Checkbox and hasAndBelongsToMany (HABTM)

2011-07-27 Thread eraonline
Ben it's working the problem about save with HABTM!!! My problem was: $pharmacy = new Pharmacy(); $this->set('pharmacies', $pharmacy->find('all')); The value of the parameter 'all' wasn't working. The next works!!! $pharmacy = new Pharmacy(); $this->set('pharmacies', $pharmacy->find('all'));

Re: Multiples Checkbox and hasAndBelongsToMany (HABTM)

2011-07-27 Thread eraonline
Thank you very much!!! It's working and it's magic like some things in Cake... I have problems with save with HABTM, I published other post about it called "Checkbox múltiples + HABTM". Can you help with it? Thanks! era -- Our newest site for the community: CakePHP Video Tutorials http://tv

Re: Multiples Checkbox and hasAndBelongsToMany (HABTM)

2011-07-27 Thread BenJsno
oups, I forgive a "Categorie" replacement. You must read "PharmaciesTurn" instead of "CategoriesTurn" On 27 juil, 09:50, BenJsno wrote: > Hello, > > -- in your controller function (add or edit): > ... > $pharmacies = $this->Turn->Pharmacy->find('list'); > // FOR SELECTED CHECKBOX : (only in

Re: Multiples Checkbox and hasAndBelongsToMany (HABTM)

2011-07-27 Thread BenJsno
Hello, -- in your controller function (add or edit): ... $pharmacies = $this->Turn->Pharmacy->find('list'); // FOR SELECTED CHECKBOX : (only in edit) $options['joins'] = array( array('table' => 'pharmacies_turns', 'alias' => 'PharmaciesTurn', 'type' => '

Multiples Checkbox and hasAndBelongsToMany (HABTM)

2011-07-26 Thread eraonline
Hello! I want to show in the view a list of checkbox of Pharmacies to assign to a Turn. Example: Turn: INPUT TEXT Pharmacies: CHKBOX1 CHKBOX2 CHKBOX3 Can help me with this? Thanks! eraonline -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the

Re: Find with $hasAndBelongsToMany

2011-05-30 Thread hill180
I saw that page in the manual, but glanced over the answer. Thanks! Shaz, this is what I did to solve the problem if you are still having problems. $this->Author->bindModel(array( 'hasAndBelongsToMany' => array( 'Category' => array('conditions'=>

Re: Find with $hasAndBelongsToMany

2011-05-30 Thread Shaz
I've just posted a similiar query! Googling around has given me the bindModel() method - which you can read at the bottom of the page here: http://book.cakephp.org/view/1044/hasAndBelongsToMany-HABTM But I wasn't able to get it to work for me. There's also a method using m

Find with $hasAndBelongsToMany

2011-05-30 Thread hill180
I have three models Authors Books (hasandbelongstomany category) Category They are properly configured for $hasAndBelongsToMany (books/category) relationship. I need to get all books by an author in a certain category (5 in this example) Obviously the category id is not in the authors table so

Re: How to query hasAndBelongsToMany-Models?

2011-05-19 Thread dreamingmind
mage->GalleryImage->Gallery set up and can do what you > > are looking for with this: > > > $this->Image->Gallery->find('all', > > array('conditions'=>array('Gallery.name' => 'seascapes'))); > > > Regards, >

Re: How to query hasAndBelongsToMany-Models?

2011-05-19 Thread func0der
rray('conditions'=>array('Gallery.name' => 'seascapes'))); > > Regards, > Don > > On May 18, 3:15 pm, func0der wrote: > > > > > > > > > Hey guys, > > > i'm just wondering how you can do a ordinary hasAndB

Re: How to query hasAndBelongsToMany-Models?

2011-05-18 Thread dreamingmind
r wrote: > Hey guys, > > i'm just wondering how you can do a ordinary hasAndBelongsToMany query > with cake without all these dynamic bindings and stuff. > > I'm having a gallery to galleryImages relationship but i can't search > for images in a specifi

How to query hasAndBelongsToMany-Models?

2011-05-18 Thread func0der
Hey guys, i'm just wondering how you can do a ordinary hasAndBelongsToMany query with cake without all these dynamic bindings and stuff. I'm having a gallery to galleryImages relationship but i can't search for images in a specific gallery over this relationship. This is maybe

Re: hasAndBelongsToMany gives server error in CakePHP 1.3

2011-04-07 Thread cricket
On Thu, Apr 7, 2011 at 5:58 AM, Pankaj Agrawal wrote: > yes thanks alot, > debug was one problem why i didnt know why its not working. But > interestingly i didnt do anything else and it seems to work now > > I have another problem now. In the list it shows the id numbers unless > i have a field c

Re: hasAndBelongsToMany gives server error in CakePHP 1.3

2011-04-07 Thread Pankaj Agrawal
yes thanks alot, debug was one problem why i didnt know why its not working. But interestingly i didnt do anything else and it seems to work now I have another problem now. In the list it shows the id numbers unless i have a field called name, can we make it show someother field? On Apr 6, 1:51 

Re: hasAndBelongsToMany gives server error in CakePHP 1.3

2011-04-05 Thread cricket
On Tue, Apr 5, 2011 at 3:08 PM, Pankaj Agrawal wrote: > Error Message: > "An Internal Error Has Occurred > Error: An Internal Error Has Occurred." Is this message from your code somewhere? Which web server are you using? Apache? IIS? > No logs in errors and debug logs What about the server's lo

Re: hasAndBelongsToMany gives server error in CakePHP 1.3

2011-04-05 Thread Pankaj Agrawal
'conditions'=>null, 'fields'=>null ) ); var $hasAndBelongsToMany = array('Tag'); } ?> On Apr 5, 10:22 pm, cricket wrote: > On Tue, Apr 5, 2011 at 9:58 AM, Pankaj Agrawal > wrote: > > Hi

Re: hasAndBelongsToMany gives server error in CakePHP 1.3

2011-04-05 Thread cricket
On Tue, Apr 5, 2011 at 9:58 AM, Pankaj Agrawal wrote: > Hi, > > I have tried alot of example as It like i am not able to find a > solution. Is there a problem in using hasAndBelongsToMany in CakePHP > 1.3 or is there any change from older versions because I am trying to >

hasAndBelongsToMany gives server error in CakePHP 1.3

2011-04-05 Thread Pankaj Agrawal
Hi, I have tried alot of example as It like i am not able to find a solution. Is there a problem in using hasAndBelongsToMany in CakePHP 1.3 or is there any change from older versions because I am trying to use it but it give Internal Server All the time. Even with direct book examples. -- Our

Re: hasAndBelongsToMany - how to call a table?

2010-12-27 Thread ProtoLD
>From a normalized standpoint, you either have no need of the "reviews" table and should move the comments field into the "cars_users" table, OR If you need the comments, shouldn't they be linked to the individual id of the "cars_users" table itself? so cars_users=>id to users for user comments?

Re: hasAndBelongsToMany - how to call a table?

2010-12-26 Thread InYan
Thank you. All fixed: http://img-fotki.yandex.ru/get/5501/web-odissey.0/0_562bf_ef26078b_orig The code in the model is correct(?): http://img-fotki.yandex.ru/get/5406/web-odissey.0/0_562c0_dce1a531_orig On 26 дек, 22:16, Ryan Schmidt wrote: > On Dec 26, 2010, at 11:34, InYan wrote: > > > I am a

Re: hasAndBelongsToMany - how to call a table?

2010-12-26 Thread Ryan Schmidt
On Dec 26, 2010, at 11:34, InYan wrote: > I am a novice cake. Please help. My problem is drawn in the > picture( > http://img-kiev.fotki.yandex.ru/get/4907/web-odissey.0/0_5625e_4d94e180_orig > ). I do not know how to correctly identify the table in compliance > with the convention of cake. I t

hasAndBelongsToMany - how to call a table?

2010-12-26 Thread InYan
I am a novice cake. Please help. My problem is drawn in the picture( http://img-kiev.fotki.yandex.ru/get/4907/web-odissey.0/0_5625e_4d94e180_orig ). I do not know how to correctly identify the table in compliance with the convention of cake. Check out the new CakePHP Questions site http://cakeqs.

Re: Constants in hasAndBelongsToMany relationship.

2010-11-16 Thread kura
null > etc. > > Thus your example becomes: > > Seminar HABTM Classifier > OtherModel HABTM Classifier > etc. > > Hope you get the idea, enjoy, >    John > > On 14 Nov., 08:29, kura wrote: > > > > > > > > > Hi, > > > This may be a v

Re: Constants in hasAndBelongsToMany relationship.

2010-11-14 Thread John Andersen
ery basic question, but I've been struggling with a > design problem in hasAndBelongsToMany relationship. > > I have a "Seminar" model that represents seminar information, and each > of the seminar can have many payment methods like in Cash, CreditCard, > Bank Transfer, etc

Constants in hasAndBelongsToMany relationship.

2010-11-13 Thread kura
Hi, This may be a very basic question, but I've been struggling with a design problem in hasAndBelongsToMany relationship. I have a "Seminar" model that represents seminar information, and each of the seminar can have many payment methods like in Cash, CreditCard, Bank Transfe

Re: hasAndBelongsToMany Relationship

2010-05-10 Thread WebbedIT
Ok you've mentioned a 3 part process there, at which point are you coming unstuck? - Finding the data and passing it to the view - Using form helper to create a form populated with your data - Submitted the form and saving the changed data What does your dbase schema look like, are you happy that

Re: hasAndBelongsToMany Relationship

2010-05-09 Thread Stefano Martins
I'm having problem saving data. I'm building the view for the action, but I don't really know how to save data in this case, 'cos I can't figure out how to make the view using the $formHelper, receiving the data using the $this->data in the controller and using the $this- >Something->save() method

Re: hasAndBelongsToMany Relationship

2010-05-08 Thread WebbedIT
You've outlined your models, controllers and actions but have not really told us what problem you are having. Are you having issues with finding data, displaying data or saving data? HTH Paul Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related

hasAndBelongsToMany Relationship

2010-05-08 Thread Stefano Martins
Hello folks, I'm having the following problem to solve with CakePHP, but I'm kinda without any north, probably a silly question... Developing a software which controls production orders and stock, each finished product consists of a group of items, in a hasAndBelongsToMany relatio

Emulate $hasAndBelongsToMany

2009-08-30 Thread jmmg77
Hi, I've built a contact management system using $hasAndBelongsToMany and I'm almost finished. I just found out that habtm associations don't work across multiple databases. I've gone through all the models and used $hasMany and $belongsTo instead. I liked the arrays I

Multiple hasAndBelongsToMany associations

2009-08-12 Thread jburns
I have a properties (as in houses) table and a users table. I have a number of tables that join these two, for example property_viewings, property_favourites and property_ratings. The table structures are quite simple; an id column, property_id, user_id and occasionally some additional fields. I'd

Baked views missing hasAndBelongsToMany select boxes

2009-07-17 Thread ML
Hi, I've baked models, controllers, and views for 2 tables that have a hasAndBelongsToMany relationship to each other. The models are Item and Category, and the categories_items table exists with id, category_id, and item_id columns. However if I add or edit an item, for example, the

Add additional field in a hasandbelongstomany association

2009-05-04 Thread Jason T.
Hello-- I am building a site where there will be customers and products. I built a customers_products table and set up all the hasandbelongstomany associations correctly. My table is: * id * customer_id * product_id Very simple, and it works fine. I want to have the notion of a large or

Re: Tagging system in Cake - hasAndBelongsToMany problems

2009-04-05 Thread Ben Coleman
this. Oh well Thanks again. On Apr 4, 11:07 am, Ben Coleman wrote: > Hi, > > I've been using Cake for some time, but recently hit a problem with > hasAndBelongsToMany. > I have a videogame database, I'm trying to add a tagging system to it. > I'm storing my tags

Re: Tagging system in Cake - hasAndBelongsToMany problems

2009-04-05 Thread Walther
iations are correctly configured it should work. Read up about it at http://book.cakephp.org/view/474/Containable On Apr 4, 12:07 pm, Ben Coleman wrote: > Hi, > > I've been using Cake for some time, but recently hit a problem with > hasAndBelongsToMany. > I have a videogame database,

Re: Tagging system in Cake - hasAndBelongsToMany problems

2009-04-04 Thread brian
Have a look at this tip: http://bakery.cakephp.org/articles/view/quick-tip-doing-ad-hoc-joins-in-model-find On Sat, Apr 4, 2009 at 6:07 AM, Ben Coleman wrote: > > Hi, > > I've been using Cake for some time, but recently hit a problem with > hasAndBelongsToMany. > I ha

Re: Tagging system in Cake - hasAndBelongsToMany problems

2009-04-04 Thread Teh Treag
Ben, Here is an example from the book - http://book.cakephp.org/en/view/83/hasAndBelongsToMany-HABTM -teh $this->Recipe->bindModel(array( 'hasOne' => array( 'RecipesTag', 'FilterTag' => array(

Tagging system in Cake - hasAndBelongsToMany problems

2009-04-04 Thread Ben Coleman
Hi, I've been using Cake for some time, but recently hit a problem with hasAndBelongsToMany. I have a videogame database, I'm trying to add a tagging system to it. I'm storing my tags in 3NF. So I have a model for games which is binding Games to Tags with hasAndBelongsToMany

Re: Articles both hasOne and hasAndBelongsToMany Photos ... What's the syntax?

2009-03-21 Thread NiteRain
My Problem is similar, however, I don't seem to understand. /models/user.php class User extends AppModel { public $name = 'User'; public $hasAndBelongsToMany = array( '

Re: Articles both hasOne and hasAndBelongsToMany Photos ... What's the syntax?

2009-03-11 Thread mattalexx
It works! You guys rock. Thanks. On Mar 11, 7:28 am, ohcibi wrote: > if you have two different types of photos for your news, which should > use the same photo-model you can define other model-aliases. like > this: > > app/models/article.php: > var $hasAndBelongsToMany = a

Re: Articles both hasOne and hasAndBelongsToMany Photos ... What's the syntax?

2009-03-11 Thread mattalexx
icle.php: > var $hasAndBelongsToMany = array( >     'Photo' => array( >         'className' => 'Photo', // should be the name of the Photo- > Model >         // rest of habtm defintion of the normal photos >     ) > ); > var $belongsTo = array(

Re: Articles both hasOne and hasAndBelongsToMany Photos ... What's the syntax?

2009-03-11 Thread ohcibi
if you have two different types of photos for your news, which should use the same photo-model you can define other model-aliases. like this: app/models/article.php: var $hasAndBelongsToMany = array( 'Photo' => array( 'className' => 'Photo'

Re: Articles both hasOne and hasAndBelongsToMany Photos ... What's the syntax?

2009-03-11 Thread Xoubaman
but looks good. On Mar 11, 10:38 am, mattalexx wrote: > What's the syntax for adding an "extra field" to the > $hasAndBelongsToMany var? > > Thank you for you response. > > On Mar 11, 2:43 am, Xoubaman wrote: > > > You can model it like a normal HABTM r

Re: Articles both hasOne and hasAndBelongsToMany Photos ... What's the syntax?

2009-03-11 Thread mattalexx
What's the syntax for adding an "extra field" to the $hasAndBelongsToMany var? Thank you for you response. On Mar 11, 2:43 am, Xoubaman wrote: > You can model it like a normal HABTM relationship with an extra field > named main_photo. > > On Mar 11, 8:30 am, mattalex

Re: Articles both hasOne and hasAndBelongsToMany Photos ... What's the syntax?

2009-03-11 Thread Xoubaman
You can model it like a normal HABTM relationship with an extra field named main_photo. On Mar 11, 8:30 am, mattalexx wrote: > My articles have and belong to many photos. This is so when the photo > is seen somewhere else on the site, I can have a "see related > articles". Each article also has

Articles both hasOne and hasAndBelongsToMany Photos ... What's the syntax?

2009-03-11 Thread mattalexx
My articles have and belong to many photos. This is so when the photo is seen somewhere else on the site, I can have a "see related articles". Each article also has one main photo. I can't seem to figure out the syntax for this in APP/models/article.php file and in APP/models/photo.php. --~--~---

Re: hasAndBelongsToMany returns 1

2009-03-07 Thread Son Dat Giang
i! I'm beginner with cakephp. > > I have binded models with HABTM > > Model 'Field': > ** > var $name = 'Field'; >var $hasAndBelongsToMany = array( >'Category' => array('className' =>

hasAndBelongsToMany returns 1

2009-03-06 Thread Curly
Hi! I'm beginner with cakephp. I have binded models with HABTM Model 'Field': ** var $name = 'Field'; var $hasAndBelongsToMany = array( 'Category' => array('className' => 'Category') ); ***

Re: hasAndBelongsToMany (HABTM) and Pagination

2009-02-27 Thread mscdex
On Feb 27, 3:55 am, Gianluca Gentile wrote: > Other idea? :) Try either changing the 'recursive' to 1 or use the containable behavior. For the latter option, you have to make sure your appropriate models have "Containable" in their $actsAs array. Then try: var $paginate = array('conditions' => a

Re: hasAndBelongsToMany (HABTM) and Pagination

2009-02-27 Thread Gianluca Gentile
Not work... Warning (512): SQL Error: 1054: Unknown column 'Site.category_id' in 'where clause' [CORE/cake/libs/model/datasources/dbo_source.php, line 514] Query: SELECT COUNT(*) AS `count` FROM `tags` AS `Tag` WHERE ((`Site`.`category_id` = 2) AND (`Tag`.`id` = 2)) Warning (512): SQL Error: 10

Re: hasAndBelongsToMany (HABTM) and Pagination

2009-02-26 Thread mscdex
On Feb 26, 10:46 am, Gianluca Gentile wrote: > I want to use pagination with this conditions (for example): > > Site.category_id = '1' AND Tag.id = '1' OR Tag.id = '2' Try: var $paginate = array('conditions' => array('AND' => array ('Site.category_id' => 1, 'OR' => array('Tag.id' => 1, 'Tag.id'

hasAndBelongsToMany (HABTM) and Pagination

2009-02-26 Thread Gianluca Gentile
Hi all, I have a problem with hasAndBelongsToMany (HABTM) and pagination... Site Model: $hasAndBelongsToMany = array('Tag' => array('className'=> 'Tag')); $belongsTo = array('Category','Webagency'); Tag Model: $hasAndBelongsToMany = a

Re: Problem with custom model function on hasAndBelongsToMany relationship

2009-02-16 Thread rob_page
t someone can help me with this very odd problem.   I'm > > trying to call a custom model function, and I keep getting the > > following error: > > > SQL Error: 1064: You have an error in your SQL syntax; > > Query: getSystemUsePercent > > > Now, I&

Re: Can you have multiple hasAndBelongsToMany relationships in one model?

2009-02-16 Thread mklappen
Thanks... I did try that but must have made a typo somewhere because it didn't work when I did. got it all working. Thanks again. On Feb 16, 6:00 pm, "Adam Royle" wrote: > var $hasAndBelongsToMany = array('Developer','Publisher'); > > - Ori

Re: Problem with custom model function on hasAndBelongsToMany relationship

2009-02-16 Thread brian
ror: > > SQL Error: 1064: You have an error in your SQL syntax; > Query: getSystemUsePercent > > Now, I'm using custom model functions in many other places in my > application, but this one is different in that the model is for a > hasAndBelongsToMany

Re: Can you have multiple hasAndBelongsToMany relationships in one model?

2009-02-16 Thread Adam Royle
var $hasAndBelongsToMany = array('Developer','Publisher'); - Original Message - From: "mklappen" To: "CakePHP" Sent: Tuesday, February 17, 2009 9:24 AM Subject: Can you have multiple hasAndBelongsToMany relationships in one model? > > H

Problem with custom model function on hasAndBelongsToMany relationship

2009-02-16 Thread rob_page
her places in my application, but this one is different in that the model is for a hasAndBelongsToMany relationship (model is TradingAccountsTradingSystem). The relationships in TradingAccountsTradingSystem model are var $belongsTo = array( 'TradingAccount'

Can you have multiple hasAndBelongsToMany relationships in one model?

2009-02-16 Thread mklappen
Hi, I'm new to cake and this group, I would like to know if it is possible to add multiple hasAndBelongsToMany relationships in one model? ( I assume it is...) my declaration & first instance of it is working fine, however it's not letting me add another... example: Thanks

Creating HasAndBelongsToMany Checkboxes in the View

2009-02-15 Thread Aurelius
Hi! I've writen checkboxes for a HasAndBelongsToMany Association (without form helper) checkboxname = data[languages][languages][], the value are the language_ids so adding new checked languages works fine, but they doens't automaticly get deleted when they are unchecked, what do

Re: hasAndBelongsToMany issue

2008-11-17 Thread omar.laverde
averde" <[EMAIL PROTECTED]> wrote: > Hi to every one, > > i am using the hasAndBelongsToMany (cake 1.2) using this tables: > profiles, roles, profiles_roles. > > the way how it works it`s that the profile has many roles and the > profiles_roles is the middle table, th

hasAndBelongsToMany issue

2008-11-16 Thread omar.laverde
Hi to every one, i am using the hasAndBelongsToMany (cake 1.2) using this tables: profiles, roles, profiles_roles. the way how it works it`s that the profile has many roles and the profiles_roles is the middle table, the problem that i have is that in the edit.ctp is displaying the id of the

hasAndBelongsToMany problem

2008-11-05 Thread ormhater
I have created a join table between Recipes and Categories table name categories_recipes as create table categories_recipes (category_id int(11) not null, recipe_id int(11) not null) engine innodb; And in the Recipes model I put: var $hasAndBelongsToMany = array('Cat

Re: HasAndBelongsToMany

2008-10-01 Thread majna
first, by cake naming convention there shall be: categories_forms(category_id, form_id) After that you should read from manual chapter "Saving hasAndBelongsToMany Relations" form http://book.cakephp.org/view/312/Models There is sample form markup. You can use cake bake console to "

HasAndBelongsToMany

2008-10-01 Thread Copot
Hi everyone. I have the following problem (I'm using Cake 1.1). Three tables: forms, categories, forms_categories. forms (id, name) categories (id, name) forms_categories(id, id_form, id_category) Forms hasAndBelongsToMany Category Category hasAndBelongsToMany

$hasandbelongstomany is working cake 1.1.x but not in 1.2.x ? pls help??

2008-09-26 Thread techiguy
Hi Guys, I have one problem pls help. i have 3 tables users,roles,users_roles and thier models are (User,Role,UsersRole) a user has and belongs to many roles for that i have done intersecting the other models in user model(user.php) in this way. var $hasAndBelongsToMany = array( '

Re: changing data in the hasAndBelongsToMany tables

2008-09-17 Thread nachopitt
Hey thanks a lot for this information. Do you know how to handle this when you have multiple People to be attached to the same Match, along with the roles? On Sep 16, 12:08 pm, Dérico Filho <[EMAIL PROTECTED]> wrote: > Just solved it: > >                 $this->Match->save( >                    

Re: changing data in the hasAndBelongsToMany tables

2008-09-16 Thread Dérico Filho
Just solved it: $this->Match->save( Array( "Match" => Array( "id" => $match_id ), "Person" => Array(

changing data in the hasAndBelongsToMany tables

2008-09-16 Thread Dérico Filho
Hi, I have two tables: matches people linked together by: matches_people Well, on the matches_people table there are other fields but match_id and person_id, for instance: role, a enum type field. The question is how do I save data into matches_people in way I can also update the role fi

Re: Problem with hasAndBelongsToMany association

2008-09-16 Thread salgua1977
I've found the gap! I added in the contact model var $displayField = 'surname'; Thx On 16 Set, 16:26, salgua1977 <[EMAIL PROTECTED]> wrote: > Hi, > > I have an association "hasAndBelongsToMany" between 2 models. It > works, but when I add a relate

Problem with hasAndBelongsToMany association

2008-09-16 Thread salgua1977
Hi, I have an association "hasAndBelongsToMany" between 2 models. It works, but when I add a related field in a form (example: I have a form to add nations, there is an association between nation and contact model, and I want in the nation model a list field to select contacts), this f

Re: hasAndBelongsToMany - Pagination

2008-08-27 Thread Elmo
ng results from the controller on > hasAndBelongsToMany. Is there any other way to do this? can you please > help me... I'm passing arguments on my controller, the argument then > must be use to filter the results from hasAndBelongs

hasAndBelongsToMany - Pagination

2008-08-27 Thread lordojazz
I'm having problems in filtering results from the controller on hasAndBelongsToMany. Is there any other way to do this? can you please help me... I'm passing arguments on my controller, the argument then must be use to filter the results from hasAndBelongsToMany relationship

hasAndBelongsToMany relation - unique is not used

2008-06-06 Thread HappyNoff
Hi all, Sorry if this message has already been sent. I'm having trouble with a habtm relation. I need a non unique relation. But even if I set unique to false in my models it's not used when I use findAll. So I looked in the code and found that in /cake/libs/model/datasources/ dbo_source.php ab

  1   2   3   4   >