public function getRelationships()
{
$r = [];
$properties = $this->reflection_obj->getProperties();
foreach ($properties as $property) {
/** @var OneToOne $oto */
$oto = $this->annotation_reader->getPropertyAnnotation($property, self::OTO_ANNOTATION);
if ($oto) {
$r[] = $this->createRelationship($property->getName(), RelationshipType::ONETOONE(), $oto);
}
/** @var OneToMany $otm */
$otm = $this->annotation_reader->getPropertyAnnotation($property, self::OTM_ANNOTATION);
if ($otm) {
$r[] = $this->createRelationship($property->getName(), RelationshipType::ONETOMANY(), $otm);
}
/** @var ManyToOne $mto */
$mto = $this->annotation_reader->getPropertyAnnotation($property, self::MTO_ANNOTATION);
if ($mto) {
$r[] = $this->createRelationship($property->getName(), RelationshipType::MANYTOONE(), $mto);
}
/** @var ManyToMany $mtm */
$mtm = $this->annotation_reader->getPropertyAnnotation($property, self::MTM_ANNOTATION);
if ($mtm) {
$r[] = $this->createRelationship($property->getName(), RelationshipType::MANYTOMANY(), $mtm);
}
}
return $r;
}