Ticket #1395 (closed defect: fixed)

Opened 10 months ago

Last modified 9 months ago

Calculated columns (created in preHydrate) are lost

Reported by: killroyboy Owned by: romanb
Priority: blocker Milestone: 1.0.3
Component: Query/Hydration Version: 1.0.0
Severity: Keywords:
Cc: Has Test: no
Status: Pending Core Response Has Patch: no

Description (last modified by killroyboy) (diff)

Since RC1, my calculated columns (created in a listener's preHydrate) are removed in the Doctrine_Record::cleanData function.

r4772 appears to have added significant code to the Doctrine_Record::load function including the Doctrine_Record::cleanData which removes the calculated columns.

Attachments

1395TestCase.php (2.0 KB) - added by killroyboy 10 months ago.
Coverage for #1395 -- can't get it to fail

Change History

Changed 10 months ago by guilhermeblanco

  • status changed from new to closed
  • resolution set to worksforme

Hi killroyboy,

I'll have to mark this ticket as "works for me". I'm unable to reproduce the issue on svn branch 1.0.0.

I added coverage to all possibilities I've imagined, without success. Coverage to this ticket was added in r4870. Your ticket reports the same issue of ticket #1381. Please provide a failing test case, otherwise I cannot address the issue.

Regards,

Changed 10 months ago by killroyboy

  • status changed from closed to reopened
  • resolution worksforme deleted

What is the importance of the cleanData method in the Doctrine_Record::load method? And why was it added in RC1? That is what broke my code. If I comment out the cleanData method, everything works fine.

Working on a failing test case.

Changed 10 months ago by killroyboy

I think I've figured out why cleanData caused the problem, but don't know how to fix it. Apparently, $this->_data isn't supposed to contain my calculated fields. They should be in $this->_values.

I do have _some_ "calculated" fields that are working. It appears that the ones that are not working are the ones that are manipulated/added in external functions where I pass the $event->data array to a function that is within a non-doctrine class and then return the data array. I've tried passing by reference as well as value (and returning the array into $event->data). Neither one seems to result in the calculated fields ending up in the $_values array inside the object.

Any ideas?

I can't figure out the failing test case. Everything seems to be working as expected when I build a test case. So there is something I am doing in my code that is making it not work.

Changed 10 months ago by killroyboy

Coverage for #1395 -- can't get it to fail

Changed 10 months ago by guilhermeblanco

I think you should attach your code and let's see if we can find what's going on.

Cheers,

Changed 10 months ago by killroyboy

I would love to do that, but I don't think my employer would like it too much.

The heart of the issue is how fields get from the $_data array into the $_values array. Because the $event->data array properly gets updated even after the listener. cleanData then strips out the fields not set directly inside the preHydrate.

What makes Doctrine move data from $_data to $_values?

Changed 10 months ago by killroyboy

  • description modified (diff)

Changed 10 months ago by anonymous

  • milestone New deleted

Milestone New deleted

Changed 10 months ago by jwage

  • milestone set to 1.0.3

If you can't attach your code can you create a failing test case with the same type of code to replicate the problem?

Changed 10 months ago by killroyboy

That's the problem. I can't get the test case to fail. I don't know what my code is doing differently. I've tried several approaches to mimic my code, but nothing seems to be working.

Until I can figure this out, we are stuck on BETA-1 (unless I comment out the cleanData line in Doctrine_Record::load)

Changed 9 months ago by jwage

  • owner changed from guilhermeblanco to romanb
  • status changed from reopened to new

Roman, I added coverage for this in r4975.

Can you clarify why the cleanData is needed? When I remove it, all the tests still pass. Just leave your comments and then re-assign it back to me.

Changed 9 months ago by jwage

  • status changed from new to closed
  • resolution set to fixed

In r4995 this was fixed. Thanks for the report and sorry for the regression/inconvenience.

Changed 9 months ago by romanb

If the tests pass i think this change is fine.

Note: See TracTickets for help on using tickets.