function findProperty($name) { $property = Reflection::getProperty($name); foreach ($this->properties as $p) { if ($p->matches(substr($name, 3), $property)) { return $p; } } foreach ($this->manyToManyRelations as $p) { if ($p->matches(substr($name, 3), $property)) { return $p; } } foreach ($this->manyToOneRelations as $p) { if ($p->matches(substr($name, 3), $property)) { return $p; } } }