public function __sleep()
{
// This metadata is always serialized/cached.
$serialized = array('fieldMappings', 'xmlFieldMap', 'identifier', 'name', 'namespace', 'isRoot', 'xmlName', 'generatorType', 'idGenerator');
// The rest of the metadata is only serialized if necessary.
if ($this->lifecycleCallbacks) {
$serialized[] = 'lifecycleCallbacks';
}
if ($this->changeTrackingPolicy != self::CHANGETRACKING_DEFERRED_IMPLICIT) {
$serialized[] = 'changeTrackingPolicy';
}
if ($this->customRepositoryClassName) {
$serialized[] = 'customRepositoryClassName';
}
if ($this->isMappedSuperclass) {
$serialized[] = 'isMappedSuperclass';
}
if ($this->xmlNamespaces) {
$serialized[] = 'xmlNamespaces';
}
return $serialized;
}