I’m refactoring old symfony 3 and doctrine 1.3 project;
I have 2 classes in same table: Journal and Conference mapped by their same parent Periodic.
/**
* @ODMDocument(collection="periodics")
* @ODMInheritanceType("SINGLE_COLLECTION")
* @ODMDiscriminatorField("periodic_type")
* @ODMDiscriminatorMap({
"journal"=BundleDocumentJournal::class,
"conference"=BundleDocumentConference::class,
})
* @GedmoSoftDeleteable(fieldName="deletedAt", timeAware=false)
*/
class Periodic {
...
}
/**
* @ODMDocument()
*/
class Conference extends Periodic {
...
}
/**
* @ODMDocument()
*/
class Journal extends Periodic {
...
}
I have also a class Assembly with referenceOne to Periodic:
class Assembly{
/**
* @ODMReferenceOne(
* targetDocument=Periodic::class,
* nullable=true
* )
*/
protected $periodic;
/**
* @return mixed
*/
public function getPeriodic()
{
return $this->periodic;
}
/**
* @param mixed $periodic
* @return $this
*/
public function setPeriodic($periodic)
{
$this->periodic = $periodic;
return $this;
}
}
The is a problem with getting Periodic from Assembly as I got object of Periodic class not Journal or Conference.
Please advice how to deal with it.