[Dbix-class] How to avoid find when create related records

Roman Daniel roman.daniel at davosro.cz
Sat Feb 3 18:58:53 GMT 2018


I tried just now, I replaced the create({...}) with populate([{...}]) but
the result is same. When I turn on DBI_TRACE I clearly see the SELECT FROM
address table, which I want to avoid.

Roman

2018-02-03 19:08 GMT+01:00 Andrew Beverley <andy at andybev.com>:

> On Sat, 3 Feb 2018 17:05:06 +0100 Roman Daniel wrote:
> > When I create customer together with address and pass the adress as
> > hashref (which is very comfortable), the address resultset is first
> > searched for the values passed and only if the address is not found,
> > new address is created.
> >
> > Is there a way to make DBIC skip the find and always create the
> > related record (while passing related record as plain hashref)?
>
> Have you tried using populate() instead of create()?
>
> Andy
>
> _______________________________________________
> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> Searchable Archive: http://www.grokbase.com/group/
> dbix-class at lists.scsys.co.uk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20180203/e26dd543/attachment.htm>


More information about the DBIx-Class mailing list