[Dbix-class] Creating a new related object on another new object (with a belongs_to relationship)

Zbigniew Lukasiak zzbbyy at gmail.com
Wed Sep 3 20:36:32 BST 2008


On Wed, Sep 3, 2008 at 5:54 PM, Matt S Trout <dbix-class at trout.me.uk> wrote:
> On Sat, Aug 30, 2008 at 11:12:48AM +0200, Zbigniew Lukasiak wrote:
>> Hi,
>>
>> It looks that now it is not possible to create a new object from
>> another new one.  I don't know if that is big deal - and I can adapt
>> my code to that - but just FYI:
>>
>> $undef_artist_cd->related_resultset('artist')->new({name => 'foo'});
>>
>> (added in t/66relationship line 216)
>>
>> this now fails with "Can't abstract implicit construct, condition not a hash".
>
> That's because fixing another bug has exposed inconsistent things we're
> doing.

I've seen http://dev.catalyst.perl.org/svnweb/bast/revision/?rev=4773
- that's why I tested that :)

>
> My plan is to fix $undef_artist_cds->new_related
>
> The long form that you propose I don't know if can work sanely.
>

I use it because I pass the resultset around - I think this is not
uncommon (just think about restricted by object), but I can find a
workaround for sure.

I think it now does the right thing for the $def_artist_cd.  And
actually it also does the right thing for the undef case when you just
remove the guard throwing the exception - it then ignores the
additional '0=1' clause.  I did not see any additional test to fail.


-- 
Zbigniew Lukasiak
http://brudnopis.blogspot.com/
http://perlalchemy.blogspot.com/



More information about the DBIx-Class mailing list