[MODM-168] Can't Use Custom Repository Class for Embedded Doc When Using YAML Driver Created: 29/Jul/12  Updated: 29/Jul/12

Status: Open
Project: Doctrine MongoDB ODM
Component/s: Mapping Drivers
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Isaac Foster Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

When using the Yaml driver the ClassMetadata generation process won't create and use the indicated custom repository class for an embedded document. From what I can see digging into the actual code, it will work when using the Annotations or XML drivers, but in the Yaml driver the call to setCustomRepositoryClass is inside of a conditional that only gets entered if the document type is 'document'.

I'm not completely sure, but from what I can see elsewhere in the code, it looks like mapped superclasses should also be able to have a custom repository class, but can't when using the Yaml driver.

So I reckon what would work would be to change the code as indicated below:

<<EXISTING CODE>>
//Doctrine/ODM/MongoDb/Mapping/Driver/YamlDriver.php, line 66
if ($element['type'] == 'document') {
if (isset($element['repositoryClass']))

{ $class->setCustomRepositoryClass($element['repositoryClass']); }

} elseif ($element['type'] === 'mappedSuperclass')

{ $class->isMappedSuperclass = true; }

elseif ($element['type'] === 'embeddedDocument')

{ $class->isEmbeddedDocument = true; }

<<TO THIS>>
if (isset($documentAnnot->repositoryClass))

{ $class->setCustomRepositoryClass($element['repositoryClass']); }
Generated at Thu Dec 18 21:00:53 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.