Skip Menu |

This queue is for tickets about the DBIx-Class-InflateColumn-Object-Enum CPAN distribution.

Report information
The Basics
Id: 80705
Status: open
Priority: 0/
Queue: DBIx-Class-InflateColumn-Object-Enum

People
Owner: jmmills [...] cpan.org
Requestors: anthony.hinsinger [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.04
Fixed in: (no value)



Subject: Problem with $row->update()
hello, When i update a row, i've to force the column as "dirty". example : $row = $rs->find($id); $row->myenumcolumn->is_bar; # true $row->myenumcolumn->set_foo(); $row->update(); Doesn't work, DBIx::Class doesn't detect any changes, but this one works : $row->myenumcolumn->set_foo(); $row->make_column_dirty('myenumcolumn'); $row->update(); Thanks Anthony.
I am just here to say this bug is still there.
I've created a test for this and confirmed it. I'm working the ticket, worst case scenario is that I'll have to force the column to be dirty any time it inflates. The systemic problem however is "Does DBIC know when a column is an object changes state?"
On Fri Feb 28 21:02:27 2014, JMMILLS wrote: Show quoted text
> I've created a test for this and confirmed it. > I'm working the ticket, worst case scenario is that I'll have to force > the column to be dirty any time it inflates. > The systemic problem however is "Does DBIC know when a column is an > object changes state?"
This isn't a bug. It merely indicates that as a stateful object, Object::Enum is the wrong thing to inflate enums to. If you had a proper Value Object of some sort, then you'd be doing $row->enum_column($new_enum_value); which would be detected correctly.
Okay, after some discussion with mst on this matter - it seems that the real issue is that Object::Enum should be immutable in this instance. Here is a paste of the conversation https://gist.github.com/jmmills/c4dec6ade536db877db6 My process on this ticket will be thus: * Get immutability added to Object::Enum upstream (likely sans $obj->set_$value methods) * Update this inflator class to use that behavior by default. On Thu Nov 08 09:28:58 2012, http://a-toy.eu/ wrote: Show quoted text
> hello, > > When i update a row, i've to force the column as "dirty". > > example : > > $row = $rs->find($id); > > $row->myenumcolumn->is_bar; # true > > $row->myenumcolumn->set_foo(); > $row->update(); > > Doesn't work, DBIx::Class doesn't detect any changes, but this one works > : > > $row->myenumcolumn->set_foo(); > $row->make_column_dirty('myenumcolumn'); > $row->update(); > > Thanks > Anthony.