public function from($from)
{
// $from can either be
// a) a field name indicating a reference to a different document. Currently, only REFERENCE_STORE_AS_ID is supported
// b) a Class name
// c) a collection name
// In cases b) and c) the local and foreign fields need to be filled
if ($this->class->hasReference($from)) {
return $this->fromReference($from);
}
// Check if mapped class with given name exists
try {
$targetMapping = $this->dm->getClassMetadata($from);
return parent::from($targetMapping->getCollection());
} catch (BaseMappingException $e) {
return parent::from($from);
}
}