-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Properly wakeup ClassMetadata #129
Conversation
Le awesome commit message :3 |
$classMetadata = $this->propertyMetadata['classMetadata']; | ||
|
||
// @TODO: it introduces a coupling with ORM... but that seems the only way | ||
if ($classMetadata instanceof ClassMetadataInfo) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ORM metadata factory handles this - maybe avoid wrapping the metadata and fetch it from there via a name reference?
Better @Ocramius ? Didn't tested it yet, but it removes dependency to ORM. |
I updated tests @Ocramius . Can you do a quick review? |
I'm merging, I need this :). If you have any feedback, I'll fix them then. |
Properly wakeup ClassMetadata
*/ | ||
public function serialize() | ||
{ | ||
unset($this->propertyMetadata['classMetadata']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are still putting the metadata in here as it seems
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uh? I removed it when I serialize the resource metadata because I recreate it in the factory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will break if you unserialize the metadata, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mhhh no I don't think. However this PR break everything. I'm investigating.
Looking good! |
ping @Ocramius
Resource metadata holds reference to a classmetadata. However, ClassMetadata reflection fields (reflFields) are not serialized, which means that if we use APC to cache ZfrRest resource metadata, the ClassMetadata from Doctrine is not properly wake up and it crashes.
This PR fixes that by regenerating missing fields. I know it introduces a dependency to Doctrine ORM but this seems like the lightest way.