/** * @param array $values * @return void * @throws \obo\Exceptions\BadAnnotationException */ public function process(array $values) { parent::process($values); if (!\class_exists($values["targetEntity"])) { throw new \obo\Exceptions\BadAnnotationException("Relationship '" . self::name() . "' could not be built. Target entity '{$values["targetEntity"]}' doesn't exist."); } $this->targetEntity = $values["targetEntity"]; $relationship = $this->propertyInformation->relationship = new \obo\Relationships\Many($this->targetEntity, $this->propertyInformation->name); if (isset($values["cascade"])) { $this->cascadeOptions = \preg_split("#, ?#", $values["cascade"]); } if (isset($values["sortVia"])) { $relationship->sortVia = $this->sortVia = $values["sortVia"]; } if (isset($values["connectViaProperty"])) { $relationship->connectViaPropertyWithName = $this->connectViaProperty = $values["connectViaProperty"]; if (isset($values["ownerNameInProperty"])) { $relationship->ownerNameInProperty = $this->ownerNameInProperty = $values["ownerNameInProperty"]; } } elseif (isset($values["connectViaRepository"])) { $relationship->connectViaRepositoryWithName = $this->connectViaRepository = $values["connectViaRepository"]; if (!\array_search("delete", $this->cascadeOptions)) { $this->cascadeOptions[] = "delete"; } if (isset($values["ownerNameInProperty"])) { throw new \obo\Exceptions\BadAnnotationException("Annotation 'ownerNameInProperty' may be used only with 'connectViaProperty' annotation"); } } else { throw new \obo\Exceptions\BadAnnotationException("Relationship 'many' could not be built because it relies on a parameter 'connectViaProperty' or 'connectViaRepository'"); } $relationship->cascade = $this->cascadeOptions; $this->propertyInformation->dataType = \obo\Services::serviceWithName(\obo\obo::ENTITIES_EXPLORER)->createDataType(\obo\DataType\ObjectDataType::name(), $this->propertyInformation, ["className" => "\\obo\\Relationships\\EntitiesCollection"]); $this->propertyInformation->columnName = ""; $this->propertyInformation->persistable = false; }
/** * @param array $values * @return void * @throws \obo\Exceptions\BadAnnotationException */ public function process(array $values) { parent::process($values); if (\is_bool($values[0]) === false) { throw new \obo\Exceptions\BadAnnotationException("Parameter for '" . self::name() . "' annotation must be of boolean type"); } $this->propertyInformation->autoIncrement = $values[0]; }
/** * @param array $values * @return void * @throws \obo\Exceptions\BadDataTypeException */ public function process(array $values) { parent::process($values); if (count($values) > 1) { $dataTypeName = \array_shift($values); $dataTypeOptions = $values; } else { $dataTypeName = $values[0]; $dataTypeOptions = []; } $this->propertyInformation->dataType = \obo\Services::serviceWithName(\obo\obo::ENTITIES_EXPLORER)->createDataType($dataTypeName, $this->propertyInformation, $dataTypeOptions); }
/** * @param array $values * @return void * @throws \obo\Exceptions\BadAnnotationException */ public function process(array $values) { parent::process($values); $this->targetEntity = $values["targetEntity"]; if (\strpos($this->targetEntity, "property:") === 0) { $this->targetEntityInProperty = \substr($this->targetEntity, 9); if ($this->entityInformation->existInformationForPropertyWithName($this->targetEntityInProperty)) { \obo\Services::serviceWithName(\obo\obo::ENTITIES_EXPLORER)->createDataType(\obo\DataType\StringDataType::name(), $this->entityInformation->informationForPropertyWithName($this->targetEntityInProperty)); } } if (!$this->targetEntityInProperty and !\class_exists($this->targetEntity)) { throw new \obo\Exceptions\BadAnnotationException("Relationship 'one' could not be built. Entity '{$this->targetEntity}' could not be connected because it does not exist."); } if (isset($values["cascade"])) { $this->cascadeOptions = \preg_split("#, ?#", $values["cascade"]); } if (isset($values["autoCreate"])) { if (!\is_bool($values["autoCreate"])) { throw new \obo\Exceptions\BadAnnotationException("Parameter 'autoCreate' for relationship 'one' must be boolean"); } $this->autoCreate = $values["autoCreate"]; } if (isset($values["connectViaProperty"])) { $this->connectViaProperty = $values["connectViaProperty"]; if (isset($values["ownerNameInProperty"])) { $this->ownerNameInProperty = $values["ownerNameInProperty"]; } $this->propertyInformation->columnName = ""; $this->propertyInformation->persistable = false; } if (isset($values["eager"])) { $this->eager = $values["eager"]; } if ($this->eager) { $this->entityInformation->eagerConnections[] = $this->propertyInformation->name; } $this->propertyInformation->relationship = new \obo\Relationships\One($this->targetEntity, $this->propertyInformation->name, $this->cascadeOptions); $this->propertyInformation->relationship->autoCreate = $this->autoCreate; $this->propertyInformation->relationship->ownerNameInProperty = $this->ownerNameInProperty; $this->propertyInformation->relationship->connectViaProperty = $this->connectViaProperty; $this->propertyInformation->dataType = \obo\Services::serviceWithName(\obo\obo::ENTITIES_EXPLORER)->createDataType(\obo\DataType\EntityDataType::name(), $this->propertyInformation, $this->targetEntityInProperty === null ? ["className" => $this->targetEntity] : []); }
/** * @param array $values * @return void */ public function process(array $values) { parent::process($values); $this->propertyInformation->persistable = $values[0]; }
/** * @param array $values * @return void */ public function process(array $values) { parent::process($values); $this->registerUuidGenerator = $values[0]; $this->propertyInformation->dataType = \obo\Services::serviceWithName(\obo\obo::ENTITIES_EXPLORER)->createDataType(\obo\DataType\StringDataType::name(), $this->propertyInformation); }
/** * @param array $values * @return void */ public function process(array $values) { parent::process($values); $this->propertyInformation->dataType = \obo\Services::serviceWithName(\obo\obo::ENTITIES_EXPLORER)->createDataType(\obo\DataType\DateTimeDataType::name(), $this->propertyInformation); $this->eventsNames = $values; }
/** * @param array $values * @return void */ public function process(array $values) { parent::process($values); $this->propertyInformation->columnName = $values[0]; }