[CDBI] construct sucks.
"Ryan Tate" <lists-UNebACArQA1Wk0Htik3J/[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.class-dbi |
|---|---|
| Message-ID | <[email protected]> |
Uh, has anyone else ever noticed that ->construct kind of blows rocks? Specifically, if you ->construct an object that's already in the LiveObject index, CDBI will throw away perfectly good fresh data about the object -- columns not present at all in the indexed version -- and just hand you whatever incomplete object it has sitting around? This behavior I discovered using 0.96, but it seems to have been carried forward to the latest CDBI, based on eyeballing the code. This will bite you if you have an essential column inflating to a particular object, then you try and construct that object after retrieving it using custom SQL. In my case, I have two classes related many_to_many, but in one class each object also keeps a reference to one particular object from the other class because the one is special among the many related from that class. This particular object was auto-inflating but I needed to construct it later from some custom SQL retrieving all the other related objects (and some special info stored in the mapping table). Anyway, I'll probably code a patch, if only for myself, and perhaps file it with an RT bug, unless someone knows this to be By Design. Also, I'd love to hear how DBIx::Class handles this.