/** * Maybe in v1.1 * * @param $pattern * @param Object $object */ public function setupRelationRoutes($pattern, Object $object) { $objectName = $object->getBundle()->getBundleName() . '/' . lcfirst($object->getId()); $pattern = $pattern . '/{pk}/'; foreach ($object->getFields() as $field) { if ('object' === $field->getType()) { $foreignObject = $this->jarves->getObjects()->getDefinition($field->getObject()); if (!$foreignObject) { continue; } $this->setupRoutes($object->getBundle(), $object->getFinalApiController(), $pattern . lcfirst($field->getObjectRelationName() ?: $field->getId()), $objectName, $foreignObject, $object, $field); } } }