Bug #6411

Undefined index classname in DataMapper method mapSingleObject

Added by Alexandre Martinez over 5 years ago. Updated almost 5 years ago.

Status:Resolved Start date:2010-02-08
Priority:Must have Due date:
Assigned To:Karsten Dambekalns % Done:

100%

Category:Persistence
Target version:TYPO3 Flow Base Distribution - 1.0 alpha 8
PHP Version: Complexity:
Has patch: Affected Flow version:

Description

When the same object is referenced more than once in the data retrieved from database, the classname field is just set once, the second and subsequent references only return an identifier, fine if the order used to map the properties is the same, which cannot be guaranteed because the properties list is returned by reflection.

An exemple to make it clear:

A class named Link has two properties fromCondition and toCondition that reference the same object. The data array used to map the object Link has a classname value only for fromCondition.

If in the Link class definition fromCondition property preceeds toCondition property definition, everything is fine.

If the order of properties is reversed, the error is thrown.

Possible fixes could consist in always returning a classname value from database when returning multiple references to the same object or ensuring the properties are always persisted and mapped back to object in the same order.

IMHO depending on properties in fixed order should not be considered.

Bug occurs on xampp for windows 1.7.3 with FLOW3 alpha7, with default sqlite persistence backend. Didn't try it with a MySql backend.

Hope I made it clear enough.

History

#1 Updated by Karsten Dambekalns over 5 years ago

  • Status changed from New to Accepted
  • Assigned To set to Karsten Dambekalns

#2 Updated by Karsten Dambekalns over 5 years ago

  • Status changed from Accepted to Needs Feedback

Could you check the latest SVN version to see if it fixes your problem? Thanks!

#3 Updated by Alexandre Martinez over 5 years ago

Works a charm for me. Tested each combination of properties and everything is OK. Nice job. Thanks!

#4 Updated by Karsten Dambekalns over 5 years ago

  • Status changed from Needs Feedback to Resolved
  • Target version set to 1.0 alpha 8
  • % Done changed from 0 to 100

Works with current code. Yay.

Also available in: Atom PDF