Re: Need a little help with HABTM joins

2011-11-07 Thread Giorgio Tedesco
They should've been linked by a HABTM but i need to save some additional fields in the join table so i made 2x hasMany. ITA: Article e Piece dovrebbero essere linkati via HABTM, ma vuoi salvare altri campi addizionali nella Tabella ArticlePiece. ITA: ma la tabella ArticlePiece può avere

CakePHP 2.0.2: HABTM relations: Edit form seems to add relations instead of replacing them

2011-11-06 Thread Mattia Manzati
Hi all, I am building a download manager for my site. Now I am building the edit function for the downloads. I have used the console cake bake controller to create it, but it seems that each time I press save it adds a new association. Example: Post as been added with TagA and TagC. I edit it

Re: CakePHP2.0.1 - Problem with saving HABTM

2011-11-06 Thread Jon Bennett
Ok, I've upgraded to 2.0.2, changed the code of EpisodeReleaseController.php, and i have fixed the add problem. Now I am building the edit function. I have used the console cake bake controller to create it, but it seems that each time I press save it adds a new association. Example; Post

Re: CakePHP 2.0.2: HABTM relations: Edit form seems to add relations instead of replacing them

2011-11-06 Thread majna
http://book.cakephp.org/2.0/en/models/associations-linking-models-together.html#hasandbelongstomany-habtm *unique*: If true (default value) cake will first delete existing relationship records in the foreign keys table before inserting new ones, when updating a record. So existing associations

Re: CakePHP 2.0.2: HABTM relations: Edit form seems to add relations instead of replacing them

2011-11-06 Thread majna
I don't see Post or Tag model in this app. Check this line https://github.com/ilmattodel93/IMattiDel93-s-Site/blob/master/app/Model/EpisodeRelease.php#L39 or other habtm associations. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP

Re: CakePHP2.0.1 - Problem with saving HABTM

2011-11-05 Thread Mattia Manzati
Ok, I've upgraded to 2.0.2, changed the code of EpisodeReleaseController.php, and i have fixed the add problem. Now I am building the edit function. I have used the console cake bake controller to create it, but it seems that each time I press save it adds a new association. Example; Post as been

CakePHP2.0.1 - Problem with saving HABTM

2011-11-02 Thread Mattia Manzati
( [0] = 1 ) ) [VideoCodec] = Array ( [VideoCodec] = Array ( [0] = 8 ) ) ) But it seems that HABTM relations are'nt saved why? Thanks again! ^^ WebRep Overall rating

Re: CakePHP2.0.1 - Problem with saving HABTM

2011-11-02 Thread Werner Petry Moraes
( [0] = 1 ) ) [VideoCodec] = Array ( [VideoCodec] = Array ( [0] = 8 ) ) ) But it seems that HABTM relations are'nt saved why? Thanks again! ^^ WebRep Overall rating

Re: CakePHP2.0.1 - Problem with saving HABTM

2011-11-02 Thread Jon Bennett
I've had some similar trouble with 2.0 turned out the fields in the DB were not the same type. id on one table was a bigint and the foreign key on the relationship table was a regular integer. atenciosamente, With MySQL you can catch these errors at db schema level if you use foreign key

Re: CakePHP2.0.1 - Problem with saving HABTM

2011-11-02 Thread Jeremy Burns
Use InnoDB. As John says, it won't let you create RI between fields with different types (and it's very precise) and you get transactions thrwn in for good measure. On 2 Nov 2011, at 16:14, Jon Bennett wrote: I've had some similar trouble with 2.0 turned out the fields in the DB were not the

Re: CakePHP2.0.1 - Problem with saving HABTM

2011-11-02 Thread Mattia Manzati
I Have already checked, and all table are already well related. Same column type INT(11) and InnoDB powered. But I still have the problem... :S What to do now? The code I am using works if I use cakephp1.3 On 2 Nov, 17:51, Jeremy Burns jeremybu...@me.com wrote: Use InnoDB. As John says, it

Re: CakePHP2.0.1 - Problem with saving HABTM

2011-11-02 Thread Thiago Belem
Put your code on Github or Gists and send us the link. Thiago Belem, enviado do meu Android Em 02/11/2011 15:28, Mattia Manzati manzat...@gmail.com escreveu: I Have already checked, and all table are already well related. Same column type INT(11) and InnoDB powered. But I still have the

Re: CakePHP2.0.1 - Problem with saving HABTM

2011-11-02 Thread Mattia Manzati
Ok, putted code on github. This is the repo: https://github.com/ilmattodel93/IMattiDel93-s-Site Thanks again for your help! ^^ On 2 Nov, 18:47, Thiago Belem cont...@thiagobelem.net wrote: Put your code on Github or Gists and send us the link. Thiago Belem, enviado do meu Android Em

Problems with HABTM Pagnitaion and i18n

2011-10-06 Thread Jörg
Hello all, i need help. I had a brand model with $hasAndBelongsToMany = array('Category'); Category is a model with the translation on the field 'name' Now depending on a category filter in a searchbox I want to identify which brands are in the search area and which other catgeories are assigned

Miles J - Uploader - HABTM

2011-10-03 Thread styks1987
https://github.com/milesj/cake-uploader/issues/24 I have opened an issue about this problem. Does anybody have an idea of why it may not work? -- 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

Re: Cascade delete and HABTM

2011-09-20 Thread WebbedIT
You would not want to delete the associated Service as the nature of HABTM means that Service could be associated with any number of other ServiceCategory. HTH, Paul -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site

Re: Cascade delete and HABTM

2011-09-20 Thread xamako
Hi! I was wrong thinking on HABTM. Everything is working ok :-) Thanks! On 20 sep, 12:01, WebbedIT p...@webbedit.co.uk wrote: You would not want to delete the associated Service as the nature of HABTM means that Service could be associated with any number of other ServiceCategory. HTH

Re: Manual entry for habtm linking table.

2011-09-19 Thread WebbedIT
: If using Cakes HABTM automagic the table should be named classes_teachers and have the following fields id (primary_key, auto_inc) class_id teacher_id After that it's a case of INSERT INTO classes_teachers (class_id, teacher_id) SELECT class_id, teacher_id FROM import_table HTH, Paul

Cascade delete and HABTM

2011-09-19 Thread xamako
Hi! I have the following relationship between HABTM tables: - services - service_categories - Servicecategories_services (the latter is what links the two tables above) Well, what I get is that when you delete a table record service_categories, records are automatically deleted from the table

Re: Cascade delete and HABTM

2011-09-19 Thread Thomas Ploch
Have you set the 'dependent' key in *both* relationship configurations? Kind regards Thomas Am 19.09.2011 16:32, schrieb xamako: Hi! I have the following relationship between HABTM tables: - services - service_categories - Servicecategories_services (the latter is what links the two tables

Re: Cascade delete and HABTM

2011-09-19 Thread xamako
The dependent key is not avaible en HABTM http://book.cakephp.org/es/view/1044/hasAndBelongsToMany-HABTM Thanks On 19 sep, 16:41, Thomas Ploch profipl...@googlemail.com wrote: Have you set the 'dependent' key in *both* relationship configurations? Kind regards Thomas Am 19.09.2011 16:32

Re: Manual entry for habtm linking table.

2011-09-19 Thread Ritesh R Aryal
                            (.$tclass_id., .$teacher['Teacher'] ['id'].);); Cheers Chris On Sep 16, 8:37 am, WebbedIT p...@webbedit.co.uk wrote: If using Cakes HABTM automagic the table should be named classes_teachers and have the following fields id (primary_key, auto_inc) class_id teacher_id

Re: Cascade delete and HABTM

2011-09-19 Thread xamako
is not avaible en HABTMhttp://book.cakephp.org/es/view/1044/hasAndBelongsToMany-HABTM Thanks On 19 sep, 16:41, Thomas Ploch profipl...@googlemail.com wrote: Have you set the 'dependent' key in *both* relationship configurations? Kind regards Thomas Am 19.09.2011 16:32, schrieb xamako

Re: Manual entry for habtm linking table.

2011-09-18 Thread porangi.chris
, teacher_id) VALUES (.$tclass_id., .$teacher['Teacher'] ['id'].);); Cheers Chris On Sep 16, 8:37 am, WebbedIT p...@webbedit.co.uk wrote: If using Cakes HABTM automagic the table should be named classes_teachers and have the following fields id (primary_key, auto_inc

Re: Manual entry for habtm linking table.

2011-09-16 Thread WebbedIT
If using Cakes HABTM automagic the table should be named classes_teachers and have the following fields id (primary_key, auto_inc) class_id teacher_id After that it's a case of INSERT INTO classes_teachers (class_id, teacher_id) SELECT class_id, teacher_id FROM import_table HTH, Paul @phpMagpie

Re: Habtm fields input and view very important plz

2011-09-15 Thread driss
Okay I'll try that and see thanks On Sep 15, 2:11 am, Jeremy Burns | Class Outfit jeremybu...@classoutfit.com wrote: Don't do it as HABTM. Create a model and controller for the joining table and use $belongsTo and $hasMany. Jeremy Burns Class Outfit http://www.classoutfit.com On 14 Sep

Manual entry for habtm linking table.

2011-09-15 Thread porangi.chris
hi, First time user of cake with CI background, I have two tables teachers and classes that share a many to many relationship e.g. Teacher-Classes. I'm having to import the data from CSV files that have been exported from another system that we have limited access to.I've got the classes

Habtm fields input and view very important plz

2011-09-14 Thread driss
I have this data structure : Product(Id,name); Market(Id,name); Product HABTM Market ( I mean that i could have products available in many Market or store but the price is not the same for example this product X is available in Market1 and in Market2 but in market1 it's expensive than in Market2

Re: Habtm fields input and view very important plz

2011-09-14 Thread driss
is no one can help me ? any help is welcome On Sep 14, 10:12 pm, driss bounouar.dr...@gmail.com wrote: I have this data structure : Product(Id,name); Market(Id,name); Product HABTM Market ( I mean that i could have products available in many Market or store but the price is not the same

Re: Habtm fields input and view very important plz

2011-09-14 Thread Jeremy Burns | Class Outfit
Don't do it as HABTM. Create a model and controller for the joining table and use $belongsTo and $hasMany. Jeremy Burns Class Outfit http://www.classoutfit.com On 14 Sep 2011, at 23:12, driss wrote: I have this data structure : Product(Id,name); Market(Id,name); Product HABTM Market ( I

Re: Issue with habtm

2011-09-07 Thread WebbedIT
Show us your form view code and then echo your resulting data array please. HTH, Paul -- 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

Issue with habtm

2011-09-06 Thread Ruslan Inozemtsev
Hello, i'm trying to start using HABTM in Cake 1.3, but can't understand how can i add an realtion. Im trynig to create new relation between User and Project records in DB, but no data apperas in users_projects after im saving data :( My code is: $data = array( 'User' = array('id' = 1

Re: Pretty HABTM List Entry

2011-08-30 Thread O.J. Tibi
Hi Mondo, Paul is right, you should model-ise your join table, effectively creating a hasMany through association, since you're adding additional fields that are not part of the table's foreign keys. You might want to read this: http://book.cakephp.org/view/1650/hasMany-through-The-Join-Model

Re: Pretty HABTM List Entry

2011-08-29 Thread WebbedIT
28, 7:51 pm, Mondo mo...@nodegarden.net wrote: I have a Recipe, Item, and Units table/model. I have a HABTM relationship with Recipe and Item, and I get the default multiple- select box when adding/editing Recipe. (am using Bake for everything for the most part). The problem is I need

Re: Pretty HABTM List Entry

2011-08-29 Thread WebbedIT
a HABTM relationship with Recipe and Item, and I get the default multiple- select box when adding/editing Recipe. (am using Bake for everything for the most part). The problem is I need to associate quantities and units with each Item. Sample of UI I'm hoping for:http://i.stack.imgur.com

Pretty HABTM List Entry

2011-08-28 Thread Mondo
I have a Recipe, Item, and Units table/model. I have a HABTM relationship with Recipe and Item, and I get the default multiple- select box when adding/editing Recipe. (am using Bake for everything for the most part). The problem is I need to associate quantities and units with each Item. Sample

CakePHP 2 - HABTM saving issue

2011-08-27 Thread Ben McClure
' = '', 'order' = '' ), 'User' = array( 'className' = 'User', 'foreignKey' = 'user_id', 'conditions' = '', 'fields' = '', 'order' = '' ) ); But Cake isn't treating this anything like a HABTM relationship... I have a normal HABTM relationship relating users and roles, (without a join model manually

Re: CakePHP 2 - HABTM saving issue

2011-08-27 Thread Ben McClure
Well, I realized as soon as I posted that the reason the auth_sources_users records aren't getting deleted is that their user_id fields are blank... so I don't know if there's going to be a problem deleting the records or not... But what am I doing wrong when saving the data using the

Re: CakePHP 2 - HABTM saving issue

2011-08-27 Thread Ben McClure
Ok, I'm getting a little closer. Some digging in more documentation brought me to this array to use instead: Array ( [User] = Array ( [email] = (my email here) [first_name] = Ben [last_name] = McClure ) [AuthSource] = Array (

Re: Cake 2.0 beta: FormHelper + HABTM fields

2011-08-13 Thread mark_story
The way Cake generates HABTM inputs was changed for 2.0. Its supposed to be less magic, but it doesn't seem like that is the case in this situation. Having some more information on the rest of the form might help. -Mark On Aug 12, 3:23 pm, handsofaten bjud...@gmail.com wrote: Hi - I'm working

Cake 2.0 beta: FormHelper + HABTM fields

2011-08-12 Thread handsofaten
Hi - I'm working with CakePHP 2.0 beta, and having some trouble with the expected FormHelper functionality. I have in my view something like this: $i = 0; foreach($terms as $term){ echo $this-Form-input('Term.'.$i.'.id'); $i++ } From which I expect something like this to be generated: input

Re: HABTM can't save manually

2011-08-09 Thread John Andersen
, thus replacing all previous tags added to the artist (this is how HABTM normally works). 3) You want to do something different from 1 and 2 above. In 1) you probably have to consider using a HasMany relationship between Artist and ArtistTag instead of the HABTM between Artist and Tag. In 2) you

Re: HABTM can't save manually

2011-08-09 Thread mr_robot
://bakery.cakephp.org/articles/bparise/2007/05/09/add-delete-habtm-behavior seems like i'm on the right track. but $this-Artist-habtmAdd('Tag', 1, 123456); //artist_id=1, tag id = 123456 does nothing. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP

Re: HABTM can't save manually

2011-08-09 Thread John Andersen
, which is mentioned at the bottom of the page about saving HABTM data in the CakePHP book at: http://book.cakephp.org/view/1034/Saving-Related-Model-Data-HABTM Keep up the good work, enjoy, John On Aug 9, 8:27 pm, mr_robot robo...@radarboy.com wrote: hi john. yea it's 1. i have got it working

Re: HABTM can't save manually

2011-08-09 Thread mr_robot
hi john thanks for all the help (and the kind encouragement). i kinda of worked out a solution, posting here for others: $tag_count = count($artist['Tag']); $artist = $this-Tags-checkforUpdates($artist); if (count($artist['Tag'])$tag_count){ // first save all the tags foreach($artist['Tag'] as

Re: HABTM can't save manually

2011-08-08 Thread mr_robot
hi john thanks for the answer. but i am doing this: $artist['Tag'][1]['artist_id'] = 184287; regards -- 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

Re: HABTM can't save manually

2011-08-08 Thread John Andersen
Yes, I saw that, but the book says you have to do it differently in order to do it automatically. You have to refer to the Artist like this: [code] $artist['Artist']['id'] = 184287; [/code] Observe that you should not just call the save method with the $artist['Tag'] data only, but the full

Re: HABTM can't save manually

2011-08-08 Thread mr_robot
. no luck adding the whole $artist array. it starts to do weird stuff - adding values from the artist table into the artist_tags table. very confusing. will try build a form but this is all very strange - i assumed relations would be straightforward...? -- Our newest site for the

Re: HABTM can't save manually

2011-08-07 Thread John Andersen
You have to populate the related models Id in your array, as it is explained in the CakePHP book at: http://book.cakephp.org/view/1034/Saving-Related-Model-Data-HABTM So for each Tag record, add the related Artist record with just the primary key of the Artist record. Enjoy, John On Aug 5, 2

HABTM can't save manually

2011-08-05 Thread mr_robot
hi there been pulling my hair out on this one for 2 days. i have two simple models. artist and tags. and i have a artists_tags database table with artist_id and tag_id. artist model class Artist extends AppModel { var $name = 'Artist'; var $hasAndBelongsToMany = array(

Many HABTM relations in a single joinTable ?

2011-07-31 Thread Shturm681
Hi, I wonder if it's possible to get many HABTM relations working in a single table ? For example I want my Products, Pages and News to be paired as HABTM with my Images. So I have table named images_items with a model named ImageItem and the table looks like this: id - INT item_id - INT

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' =

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 bench...@yahoo.fr wrote: Hello, -- in your controller function (add or edit): ... $pharmacies = $this-Turn-Pharmacy-find('list'); // FOR SELECTED CHECKBOX : (only

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

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: Checkbox múltiples + HABTM

2011-07-27 Thread eraonline
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

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

Checkbox múltiples + HABTM

2011-07-26 Thread eraonline
Hello. I can't save multiple checkbox in HABTM. My code is: MODEL ?php class Turn extends AppModel { var $name = 'Turn'; var $hasAndBelongsToMany = array( 'Pharmacy' = array( 'className' = 'Pharmacy' ) ); var $validate = array( 'name' = array( 'rule' = 'notEmpty

HABTM again!

2011-07-21 Thread localhost
Hi everyone, I have being trying to solve this for the last 4 hours with no luck. basically I have the following tables users links users_links Basically I'm trying to get the below query to run using find('all') and paginate (I'm running this inside UserController) SELECT

Re: HABTM again!

2011-07-21 Thread Jeremy Burns | Class Outfit
If you have defined a HABTM relationship your joining table should be links_users (i.e. the tables are in alphabetical order). Jeremy Burns Class Outfit http://www.classoutfit.com On 21 Jul 2011, at 16:26, localhost wrote: Hi everyone, I have being trying to solve this for the last 4

Re: HABTM again!

2011-07-21 Thread localhost
a HABTM relationship your joining table should be links_users (i.e. the tables are in alphabetical order). Jeremy Burns Class Outfit http://www.classoutfit.com On 21 Jul 2011, at 16:26, localhost wrote: Hi everyone, I have being trying to solve this for the last 4 hours

Re: HABTM again!

2011-07-21 Thread localhost
a HABTM relationship your joining table should be links_users (i.e. the tables are in alphabetical order). Jeremy Burns Class Outfit http://www.classoutfit.com On 21 Jul 2011, at 16:26, localhost wrote: Hi everyone, I have being trying to solve this for the last 4 hours with no luck

Re: HABTM again!

2011-07-21 Thread Jeremy Burns | Class Outfit
' = '' ) ); } What do you mean by joining table should be links_users (i.e. the tables are in alphabetical order) ? On Jul 21, 6:31 pm, Jeremy Burns | Class Outfit jeremybu...@classoutfit.com wrote: If you have defined a HABTM relationship your joining table should be links_users (i.e. the tables

Re: HABTM again!

2011-07-21 Thread gremlin
completely the model for your join table - the UsersLink model. 3) define a normal habtm relationship between the User model and the Link model. 4) read the manual before you start another project - all of this is clearly explained in many translations. On Jul 21, 10:45 am, Jeremy Burns | Class Outfit

Re: MongoDB and HABTM

2011-07-19 Thread LordG
Ok, looking at the Mongo DB source code, it doesn't do any association queries. So i'm written a behavior to solve it. On Jul 18, 4:55 pm, LordG lordgthefi...@gmail.com wrote: Hello Bakers, I'm busy testing Models with MongoDB. I have two Models: Recipe and Tag. class Recipe extends

MongoDB and HABTM

2011-07-18 Thread LordG
Hello Bakers, I'm busy testing Models with MongoDB. I have two Models: Recipe and Tag. class Recipe extends AppModel { var $name = 'Recipe'; var $mongoSchema = array( 'name' = array('type' = 'string'), 'description' = array('type' = 'string'),

HABTM delete ignoring conditions definition

2011-07-07 Thread Lalas
Is CAKEPHP developer team planning to correct/adjust the _deleteLinks function in the cake\libs\model\model.php ? It ignores the conditions definition declared in the model. -- Original code: function _deleteLinks($id) { foreach ($this-hasAndBelongsToMany as $assoc = $data) {

Multi Habtm Pagination

2011-06-29 Thread Cengiz Eselioglu
Hi. I would like to paging products with multi Habtm. My tables: products categories colors And HABTM connections Product HABTM Categories products_categories Product belongsTo Color How do I make a query like the following? (width : Habtm Pagination) Category.id = 3 and Color.id=4 all

Re: Multi Habtm Pagination

2011-06-29 Thread Johan
You can either add a JOIN [1] query for each HABTM association you want to filter on the pagination find, or BIND [2] the join table models (ProductsCategory and ProductsColor) to the Product model as HasOne associations before doing the pagination. Both would require to specify that the join must

Re: habtm

2011-06-25 Thread Prabha Vathi
Hi, I m not able to get good example for habtm. I tried something. $this-Post-unbindModel(array('hasAndBelongsToMany'=array('Tag'))); $this-Post-bindModel( array( 'hasOne'=array( 'PostsTag'=array( 'foreignKey'=false

Re: habtm

2011-06-25 Thread Andras Kende
to get good example for habtm. I tried something. $this-Post-unbindModel(array('hasAndBelongsToMany'=array('Tag'))); $this-Post-bindModel( array( 'hasOne'=array( 'PostsTag'=array( 'foreignKey'=false

Re: habtm

2011-06-25 Thread Prabha Vathi
, Prabha Vathi wrote: Hi, I m not able to get good example for habtm. I tried something. $this-Post-unbindModel(array('hasAndBelongsToMany'=array('Tag'))); $this-Post-bindModel( array( 'hasOne'=array( 'PostsTag'=array

habtm

2011-06-24 Thread Prabha Vathi
Hi, In tagscontroller, $this-paginate = array('conditions' = array('Post.status' = 'active','Tag.tag_machine_value' = $name),'limit' = 3); $posts = $this-paginate('Post'); $this-set(compact('posts')); Tag and Post model have hasAndBelongsToMany relation. I am getting Unknown column

Re: habtm

2011-06-24 Thread Prabha Vathi
Any Help Please? -- 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 email to

Re: habtm

2011-06-24 Thread Master Ram...!
HI you can solve this problem usign custom query pagination. you can search in google you will get many examples. On Fri, Jun 24, 2011 at 10:02 PM, Prabha Vathi prabha.ridd...@gmail.comwrote: Hi, In tagscontroller, $this-paginate = array('conditions' = array('Post.status' =

Re: Validating HABTM

2011-06-15 Thread Rob Maurer
in Language Model instead of User Model On Jun 14, 9:56 pm, Shaz shazam...@gmail.com wrote: I have User HABTM Language, and i want to ensure during a User add / edit they choose a minimum of one language, upto a maximum of 3. In the user model, for $validate I've tried: 'Language

Re: Validating HABTM

2011-06-15 Thread Shaz
I haven't actually made models for the Join table - I don't think you need to for a HABTM relationship On Jun 15, 1:41 pm, Rob Maurer robmau...@gmail.com wrote: Interesting. What would happen if you put the validation in the model for the join table? On Jun 14, 3:17 pm, Shaz shazam

Re: Validating HABTM

2011-06-15 Thread nachopitt
You should check this: http://bakery.cakephp.org/articles/nachopitt/2010/07/01/habtm-validatable-behavior On 15 jun, 08:24, Shaz shazam...@gmail.com wrote: I haven't actually made models for the Join table - I don't think you need to for a HABTM relationship On Jun 15, 1:41 pm, Rob Maurer

Validating HABTM

2011-06-14 Thread Shaz
I have User HABTM Language, and i want to ensure during a User add / edit they choose a minimum of one language, upto a maximum of 3. In the user model, for $validate I've tried: 'Language' = array( 'multiple' = array( 'rule' = array

Re: Validating HABTM

2011-06-14 Thread hunny
Write the Validation Rule in Language Model instead of User Model On Jun 14, 9:56 pm, Shaz shazam...@gmail.com wrote: I have User HABTM Language, and i want to ensure during a User add / edit they choose a minimum of one language, upto a maximum of 3. In the user model, for $validate I've

Re: Validating HABTM

2011-06-14 Thread Shaz
that validation; where I only want the users to... Thanks! On Jun 14, 8:14 pm, hunny saurabh85maha...@gmail.com wrote: Write the Validation Rule in Language Model instead of User Model On Jun 14, 9:56 pm, Shaz shazam...@gmail.com wrote: I have User HABTM Language, and i want to ensure during

HABTM relationship don't save with Char PK

2011-06-13 Thread jorge1209
Hi, I'm using for my user table, username like PK and I have a HABTM relationship between user and messages, but when I create a message, the table messages_recipients is empty :( any help?? best regards, Jorge -- View this message in context: http://cakephp.1045679.n5.nabble.com/HABTM

HABTM Pagination

2011-05-30 Thread Shaz
I have the following relationships (habtm both ways): User HABTM Groups User HABTM Events User HABTM Locations So for example - I want to get users that belong to groupA, groupB and locationX and paginate the results - whats the best way of implementing it? I'm trying to avoid using bindModel

CakePHP 1.3 HABTM model problem

2011-05-26 Thread Lobo
Hi everyone, I have a problem when using CakePHP HABTM. I have the following models. class Repositorio extends AppModel{ var $name=Repositorio; var $hasAndBelongsToMany = array( 'Sesion' = array( 'joinTable' = 'sesions_repositorios

Miles J - Uploader plugin - issues with habtm?

2011-05-25 Thread designv...@gmail.com
Hi there, Has anyone noticed any issues with the Miles J Uploader pluign (http:// milesj.me/code/cakephp/uploader) when used in forms that have HABTM elements? If I comment out the the habtm field the uploader works like a charm, as soon is its present though it fails to upload the files return

HABTM pagination

2011-05-06 Thread Dee Johnson
Hi guys, I would like to make a $this-MODEL-find call but would only like to bring back the items related to that query and paginate the results. I tried $this-paginate('Model', ('model.field' = 'value'); and then looped through the results but it looses the pagination on the related

Re: HABTM pagination

2011-05-06 Thread Tilen Majerle
http://book.cakephp.org/view/1231/Pagination read this :) -- Lep pozdrav, Tilen Majerle http://majerle.eu 2011/5/6 Dee Johnson devario...@gmail.com Hi guys, I would like to make a $this-MODEL-find call but would only like to bring back the items related to that query and paginate the

Re: HABTM pagination

2011-05-06 Thread Dee Johnson
Not sure if you read the question fully or just didnt understand it but I have already read ALL of that and frankly it is irrelevant. :) My issue is not covered anywhere in the cake docs as i have seen. My problem is similar to this guy and I am about to give this a whirl.

Paginating HABTM related results

2011-05-05 Thread Dee Johnson
Hi guys, Im having a small issue here. I have a model1 that HABTM model2 before I send the results to the view via a set, I run a foreach loop grab the first bit of results and then another to get to the associated data. the data array at that point (associated data only is being sent

Re: Query with conditions in HABTM models

2011-04-30 Thread stas kim
record except few latest uncategorized posts. in the long run those 3 lines of code will crush your server. perhaps you should look into habtm countercache. although it is not implemented for habtm as core feature. i've come across some articles with workarounds do that and it will come down to one

Re: Query with conditions in HABTM models

2011-04-29 Thread davidhc
zijn.digi...@gmail.com wrote: On Thu, Apr 28, 2011 at 12:31 PM, david hc davi...@gmail.com wrote: Hello, I have a table posts related with table categories with de habtm table posts_categories. posts.id categories.id posts_categories.post_id posts_categories.category_id I'm trying

Re: Query with conditions in HABTM models

2011-04-29 Thread davidhc
Only one more doubt... Could I use the native cakephp paginator with this model function? Thanx! On 29 abr, 10:13, davidhc davi...@gmail.com wrote: Thank you very much, cricket! I have change your code: $ids = Set::extract($this-PostCategory-find('all'), '{n}.PostCategory.post_id'); with:

Re: Query with conditions in HABTM models

2011-04-29 Thread davidhc
Ignore my previous message... I have solved it with this http://bin.cakephp.org/view/471586323 Thank you again, cricket :D David. On 29 abr, 10:17, davidhc davi...@gmail.com wrote: Only one more doubt... Could I use the native cakephp paginator with this model function? -- Our newest site

Query with conditions in HABTM models

2011-04-28 Thread david hc
Hello, I have a table posts related with table categories with de habtm table posts_categories. posts.id categories.id posts_categories.post_id posts_categories.category_id I'm trying to get all the records WITHOUT category (because I have posts taken from RSS and not categorized yet). My model

Re: Query with conditions in HABTM models

2011-04-28 Thread cricket
On Thu, Apr 28, 2011 at 12:31 PM, david hc davi...@gmail.com wrote: Hello, I have a table posts related with table categories with de habtm table posts_categories. posts.id categories.id posts_categories.post_id posts_categories.category_id I'm trying to get all the records WITHOUT

saving HABTM data with constructing my own array data

2011-04-25 Thread HK
I wanted to save a HABTM model but without using a regular form. Consider Entity1 HABTM Entity2, so we have a DB table for entity1, one for entity2 and one like entity1_entity2. I construct my own array like: [Entity1] = (field1, field2) [Entity2] = ( [0] = (field1, field2) [1] = (field1

Re: updating habtm data with empty data (delete existing associations)

2011-04-24 Thread Tonu Tusk
Hi guys - any ideas? Am I doing this wrong, or is this just inconsistent behaviour and I should raise a ticket? cheers On Apr 22, 7:26 pm, Tonu Tusk lvot...@googlemail.com wrote: Hi there ... so let's say I have Cake habtm Ingredient and Ingredient habmt Cake If I was to prep $data

updating habtm data with empty data (delete existing associations)

2011-04-22 Thread Tonu Tusk
Hi there ... so let's say I have Cake habtm Ingredient and Ingredient habmt Cake If I was to prep $data such as [Cake][id] = 1 [Ingredient] = array(1, 2, 3) and did a Cake-save($data) this would delete any existing associating records in the join table between these two models

Re: HABTM isUnique validation throws error on join model

2011-04-13 Thread francky06l
Do you use saveAll on innoDb tables ? If not, actually set option 'atomic' = false. Try first save with options validate = only and a second saveAll with validate false. On Apr 13, 12:06 am, Jeff jeffkw...@gmail.com wrote: I've got an odd problem.  I have tables/models names and projects with

Re: Unique pairs in HABTM validation

2011-04-13 Thread francky06l
in the join table in addition to the IDs. The HABTM saves are so elegant that I'm hesitant to break them into hasManys.  In what ways is keeping it a HABTM limiting and at what point should I switch it to two hasManys instead? On Apr 12, 7:00 am, euromark dereurom...@googlemail.com wrote: yes

<    1   2   3   4   5   6   7   8   9   10   >