17452 Posts in 4473 Topics by 1971 members
|Go to End|
27 November 2007 at 10:02am
How can I fill the Tip_Tags table when I'm not using $form->saveInto(); ?
If you take a look at my code http://pastie.caboo.se/122204 around line 29 I'm doing it all wrong...
I'm wanting to 'batch' fill the tags table and fill the relationship table at once.
The tags part is easy...
27 November 2007 at 10:35am
Easy, but you gotta know it.
27 November 2007 at 11:57am
The output of Tags() is a ComponentSet I assume?
27 November 2007 at 12:14pm
I guess so.. they're in a many_many relation, but somehow I missed out that you could do
27 November 2007 at 12:18pm
Yeah, that's definitely a ComponentSet then.
If you have relationships like has_many many_many etc, then the results return a ComponentSet which is a sub-class of DataObjectSet (exactly the same as a DataObject::get() call, but with extra relationship features).
The great thing is you can also use remove(), getIdList(), addMany(), removeMany() or any other useful methods in ComponentSet for managing the relationship.
27 November 2007 at 11:38pm
Thanks, that's great!
|Go to Top|