Re: HABTM - fields in jointable
Well, again, I'm not sure what you're asking, have you looked at the Cookbook ? http://book.cakephp.org/view/439/recursive On Jan 20, 4:52 am, Ernesto e.fanz...@gmail.com wrote: i'm working on that bug :) can someone please explain me how cake loads related data? is there any doc i can read? i haven't find :( On 19 Gen, 17:03, Webweave webwe...@gmail.com wrote: What do you mean it doesn't work? Is it not firing, or are you getting an error ? On Jan 19, 7:05 am, Ernesto e.fanz...@gmail.com wrote: uhm... i -partially- found the solution... if i load data from Customers_Controller the order_customer::afterFind doesn't work... On 19 Gen, 15:29, Ernesto e.fanz...@gmail.com wrote: ok i found the solution ?php class Recipe extends AppModel { var $name = 'Recipe'; var $hasAndBelongsToMany = array( 'Tag' = array( 'className' = 'Tag', 'joinTable' = 'recipes_tags', 'with' = '', //-- here it is 'foreignKey' = 'recipe_id', 'associationForeignKey' = 'tag_id', 'unique' = true, 'conditions' = '', 'fields' = '', 'order' = '', 'limit' = '', 'offset' = '', 'finderQuery' = '', 'deleteQuery' = '', 'insertQuery' = '' ) );} ? From the cookbook: - with: Defines the name of the model for the join table. By default CakePHP will auto-create a model for you. Using the example above it would be called RecipesTag. By using this key you can override this default name. The join table model can be used just like any regular model to access the join table directly. On 19 Gen, 14:43, Ernesto e.fanz...@gmail.com wrote: Hello. i have 2 models: Customer and Order, linked together by a HABTM relationship that's working fine. the Join table (orders_customers) has the following structure: order_customer_id customer_id order_id field_A field_B field_A and field_B must be *100 everytime the data is loaded. How can i achieve this? --~--~-~--~~~---~--~~ 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 unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: HABTM - fields in jointable
i'm working on that bug :) can someone please explain me how cake loads related data? is there any doc i can read? i haven't find :( On 19 Gen, 17:03, Webweave webwe...@gmail.com wrote: What do you mean it doesn't work? Is it not firing, or are you getting an error ? On Jan 19, 7:05 am, Ernesto e.fanz...@gmail.com wrote: uhm... i -partially- found the solution... if i load data from Customers_Controller the order_customer::afterFind doesn't work... On 19 Gen, 15:29, Ernesto e.fanz...@gmail.com wrote: ok i found the solution ?php class Recipe extends AppModel { var $name = 'Recipe'; var $hasAndBelongsToMany = array( 'Tag' = array( 'className' = 'Tag', 'joinTable' = 'recipes_tags', 'with' = '', //-- here it is 'foreignKey' = 'recipe_id', 'associationForeignKey' = 'tag_id', 'unique' = true, 'conditions' = '', 'fields' = '', 'order' = '', 'limit' = '', 'offset' = '', 'finderQuery' = '', 'deleteQuery' = '', 'insertQuery' = '' ) );} ? From the cookbook: - with: Defines the name of the model for the join table. By default CakePHP will auto-create a model for you. Using the example above it would be called RecipesTag. By using this key you can override this default name. The join table model can be used just like any regular model to access the join table directly. On 19 Gen, 14:43, Ernesto e.fanz...@gmail.com wrote: Hello. i have 2 models: Customer and Order, linked together by a HABTM relationship that's working fine. the Join table (orders_customers) has the following structure: order_customer_id customer_id order_id field_A field_B field_A and field_B must be *100 everytime the data is loaded. How can i achieve this? --~--~-~--~~~---~--~~ 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 unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
[Looking 4 good practice] HABTM - fields in jointable
Hello. i have 2 models: Customer and Order, linked together by a HABTM relationship that's working fine. the Join table (orders_customers) has the following structure: order_customer_id customer_id order_id field_A field_B field_A and field_B must be *100 everytime the data is loaded. How can i achieve this? --~--~-~--~~~---~--~~ 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 unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: HABTM - fields in jointable
ok i found the solution ?php class Recipe extends AppModel { var $name = 'Recipe'; var $hasAndBelongsToMany = array( 'Tag' = array( 'className' = 'Tag', 'joinTable' = 'recipes_tags', 'with' = '', //-- here it is 'foreignKey' = 'recipe_id', 'associationForeignKey' = 'tag_id', 'unique' = true, 'conditions' = '', 'fields' = '', 'order' = '', 'limit' = '', 'offset' = '', 'finderQuery'= '', 'deleteQuery'= '', 'insertQuery'= '' ) ); } ? From the cookbook: - with: Defines the name of the model for the join table. By default CakePHP will auto-create a model for you. Using the example above it would be called RecipesTag. By using this key you can override this default name. The join table model can be used just like any regular model to access the join table directly. On 19 Gen, 14:43, Ernesto e.fanz...@gmail.com wrote: Hello. i have 2 models: Customer and Order, linked together by a HABTM relationship that's working fine. the Join table (orders_customers) has the following structure: order_customer_id customer_id order_id field_A field_B field_A and field_B must be *100 everytime the data is loaded. How can i achieve this? --~--~-~--~~~---~--~~ 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 unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: HABTM - fields in jointable
uhm... i -partially- found the solution... if i load data from Customers_Controller the order_customer::afterFind doesn't work... On 19 Gen, 15:29, Ernesto e.fanz...@gmail.com wrote: ok i found the solution ?php class Recipe extends AppModel { var $name = 'Recipe'; var $hasAndBelongsToMany = array( 'Tag' = array( 'className' = 'Tag', 'joinTable' = 'recipes_tags', 'with' = '', //-- here it is 'foreignKey' = 'recipe_id', 'associationForeignKey' = 'tag_id', 'unique' = true, 'conditions' = '', 'fields' = '', 'order' = '', 'limit' = '', 'offset' = '', 'finderQuery' = '', 'deleteQuery' = '', 'insertQuery' = '' ) );} ? From the cookbook: - with: Defines the name of the model for the join table. By default CakePHP will auto-create a model for you. Using the example above it would be called RecipesTag. By using this key you can override this default name. The join table model can be used just like any regular model to access the join table directly. On 19 Gen, 14:43, Ernesto e.fanz...@gmail.com wrote: Hello. i have 2 models: Customer and Order, linked together by a HABTM relationship that's working fine. the Join table (orders_customers) has the following structure: order_customer_id customer_id order_id field_A field_B field_A and field_B must be *100 everytime the data is loaded. How can i achieve this? --~--~-~--~~~---~--~~ 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 unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: HABTM - fields in jointable
What do you mean it doesn't work? Is it not firing, or are you getting an error ? On Jan 19, 7:05 am, Ernesto e.fanz...@gmail.com wrote: uhm... i -partially- found the solution... if i load data from Customers_Controller the order_customer::afterFind doesn't work... On 19 Gen, 15:29, Ernesto e.fanz...@gmail.com wrote: ok i found the solution ?php class Recipe extends AppModel { var $name = 'Recipe'; var $hasAndBelongsToMany = array( 'Tag' = array( 'className' = 'Tag', 'joinTable' = 'recipes_tags', 'with' = '', //-- here it is 'foreignKey' = 'recipe_id', 'associationForeignKey' = 'tag_id', 'unique' = true, 'conditions' = '', 'fields' = '', 'order' = '', 'limit' = '', 'offset' = '', 'finderQuery' = '', 'deleteQuery' = '', 'insertQuery' = '' ) );} ? From the cookbook: - with: Defines the name of the model for the join table. By default CakePHP will auto-create a model for you. Using the example above it would be called RecipesTag. By using this key you can override this default name. The join table model can be used just like any regular model to access the join table directly. On 19 Gen, 14:43, Ernesto e.fanz...@gmail.com wrote: Hello. i have 2 models: Customer and Order, linked together by a HABTM relationship that's working fine. the Join table (orders_customers) has the following structure: order_customer_id customer_id order_id field_A field_B field_A and field_B must be *100 everytime the data is loaded. How can i achieve this? --~--~-~--~~~---~--~~ 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 unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---