too....and i have a primary key field "id"...i can sleep in peace
now...
thank you. i appreciate your help. :)
On 27 Sep., 15:18, Sam <s...@masterscommission360.com> wrote:
> AFAIK, that's actually fine- any time I've used a join table to store
> meta/more than foreign keys I usually end up doing this... The 1.2
> cookbook actually recommended this, but in 1.3 it just says
> "If you plan to add any extra information to this table, it's a good
> idea to add an additional primary key field (by convention 'id') to
> make acting on the table as easy as any other model." (http://
> book.cakephp.org/view/1044/hasAndBelongsToMany-HABTM)
> Which isn't as explicit but definitely implies that it's ok.
>
> On Sep 26, 1:50 pm, Tomfox Wiranata <tomfox.wiran...@gmail.com> wrote:
>
> > hi everyone,
>
> > I found this habtm saving tutorial on the net and it wont work for me:http://bakery.cakephp.org/articles/view/add-delete-habtm-behavior
>
> > it uses both models in the relation and combines them to save or
> > delete data in the habtm-relation. now I had Problems with habtmAdd
> > and habtmDelete. some weird things happen...
>
> > So instead i did it my own way and created a model for my habtm-
> > relation:
>
> > class ProductsCategories extends AppModel
> > {
>
> > var $name = ProductsCategories';
> > var $useTable = 'products_categories';
>
> > }
>
> > so everytime a user hits the "save" button to save a relation i do
> > this really simple code using my newly created model
>
> > $this->data['ProductsCategories']['user_id']= $user_id;
> > $this->data['ProductsCategories']['product_id']= $pr_id;
> > $this->data['ProductsCategories']['visible']= "-1";
> > $saved = $this->ProductsCategories->save($this->data);
>
> > ... instead of the more complex one from the tutorial. and it seems to
> > work. now the big question..
>
> > What is wrong with my code? I am using 1.3. is this not stable?
> > insecure?`will my pc explode? ;)
> > I dont trust my "skills" here.....it just seems too easy...
>
> > i am really curios here :) thanks a lot
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
No comments:
Post a Comment