pomm-project / ModelManager

Model Manager for the Pomm database framework.
MIT License
66 stars 27 forks source link

FlexibleEntityInterface::fields() and FlexibleEntityInterface::extract() are somehow a bit redundant #65

Open pounard opened 8 years ago

pounard commented 8 years ago

I don't see much differences actually, maybe other than the fact that the extract() method will recursively parse fields and call extract() when the value is an entity. Shouldn't it be the role of whatever formatter attempt to use extract() to recursively do this job, and not to the entity itself ?

I see only one use case where you'd call it within the ModelManager is when you insert one entity, which seems an error since in update you are using fields() instead., is there a bug or is there something I didn't understood ?

Moreover, the extract() method signature states:

Return an array with a representation of the object values. It is mostly used prior to a serialization in REST API or other string responses.

which is actually NOT what's happening in your code.

chanmix51 commented 7 years ago

That’s true, I still don’t know where a better system should be set up (probably in version 3).