Christopher H. Laco wrote:
> Mark Hedges wrote:
>> On Thu, 8 Jun 2006, Christopher H. Laco wrote:
>>> If the order item and cart item instead load InflateColumn::DateTime,
>>> all hell breaks loose. If I try copying the raw value, which is a
>>> DateTime object, I get this what trying to add to a relation:
>>>
>>>> Can't use string ("Handel::Subclassing::OrderSchema") as a HASH ref while 
>>>> "strict refs" in use at F:\CatInABox\extlib/DB
>>>> Ix/Class/AccessorGroup.pm line 248.
>>> If I force the copy to eval as a string, I get this error instead:
>>>
>>>> Invalid date format: 2006-06-07T00:00:00 at 
>>>> F:\CatInABox\extlib/DBIx/Class/InflateColumn/DateTime.pm line 57
>> That date format is the default stringification for DateTime.
>> MySQL actually seems like it can deal with it, but some DB's can't.
>>
>> Sounds like this is the case where the routine needs to
>> do something like I do here in these subrefs that I import
>> for doing inflate/deflate.  The $dt_fmt_* objects are 
>> various DateTime::Format-ish objects.
> 
> I agree. The second version/error seems kind of obvious, and I'm sure
> isn't the normal way of doing things.
> 
> It's the first version/error that's really throwing me here.
> 
> Time to start digging...
> 
> 
> -=Chris

My problem is in deflate:

>       $column =>
>         {
>           inflate => sub {
>             my ($value, $obj) = @_;
>             $obj->_datetime_parser->parse_datetime($value);
>           },
>           deflate => sub {
>             my ($value, $obj) = @_;
                $obj is not an object, just a class name during a 
create_related calls?
>             $obj->_datetime_parser->format_datetime($value);
>           },
>         }



Is it normal that the deflate sub get's a class name, and not an actuall
blessed object for $obj?

-=Chris

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/

Reply via email to