[html-formfu] More complex DBIC/FormFu interaction

Nigel Metheringham nigel.metheringham at dev.intechnology.co.uk
Thu Sep 2 20:58:19 GMT 2010


On 2 Sep 2010, at 21:38, Carl Franks wrote:

> Thanks for following this up.
> I've added some docs for this.

Ah - I'll drop the partially done set I was putting together.

On a related issue...

When, as in my example, you have a condition on a many-to-many
to restrict the set of items you can link to, the use of 
   $dbic->$set_method( \@rows, $config->{link_values} );

in _save_multi_value_fields_many_to_many means that all links
initially get deleted even if they would not have been included
within the condition.

Initial way I can see to fix this would be to modify that bit of 
code in the case where a condition was set, to pull a all the 
objects that are currently linked, with the condition applied,
and then to use an add_to_$rel rather than a set_$rel

Its reasonably neat to code, although a bit heavy in terms of
actual DBIC and database operations, but would only be used in
a limited set of circumstances.   A more efficient implementation
requires fiddling with DBIC internals rather more.

	Nigel.

--
[ Nigel Metheringham             Nigel.Metheringham at InTechnology.com ]
[ - Comments in this message are my own and not ITO opinion/policy - ]







More information about the HTML-FormFu mailing list