/** * Initialize the property with its definition and values * * @param PropertyDefinitionInterface $propertyDefinition * @param mixed[] $values */ public function __construct(PropertyDefinitionInterface $propertyDefinition, array $values) { $this->propertyDefinition = $propertyDefinition; $this->setId($propertyDefinition->getId()); $this->setDisplayName($propertyDefinition->getDisplayName()); $this->setLocalName($propertyDefinition->getLocalName()); $this->setQueryName($propertyDefinition->getQueryName()); $this->setValues($values); }
/** * @param PropertyDefinitionInterface $propertyDefinition * @param array $values * @return PropertyDataInterface */ public function createPropertyData(PropertyDefinitionInterface $propertyDefinition, array $values) { if ($propertyDefinition instanceof PropertyStringDefinitionInterface) { return $this->createPropertyStringData($propertyDefinition->getId(), $values); } elseif ($propertyDefinition instanceof PropertyBooleanDefinitionInterface) { return $this->createPropertyBooleanData($propertyDefinition->getId(), $values); } elseif ($propertyDefinition instanceof PropertyIdDefinitionInterface) { return $this->createPropertyIdData($propertyDefinition->getId(), $values); } elseif ($propertyDefinition instanceof PropertyDateTimeDefinitionInterface) { return $this->createPropertyDateTimeData($propertyDefinition->getId(), $values); } elseif ($propertyDefinition instanceof PropertyDecimalDefinitionInterface) { return $this->createPropertyDecimalData($propertyDefinition->getId(), $values); } elseif ($propertyDefinition instanceof PropertyHtmlDefinitionInterface) { return $this->createPropertyHtmlData($propertyDefinition->getId(), $values); } elseif ($propertyDefinition instanceof PropertyIntegerDefinitionInterface) { return $this->createPropertyIntegerData($propertyDefinition->getId(), $values); } elseif ($propertyDefinition instanceof PropertyUriDefinitionInterface) { return $this->createPropertyUriData($propertyDefinition->getId(), $values); } throw new CmisRuntimeException(sprintf('Unknown property definition: %s', get_class($propertyDefinition))); }
/** * @param PropertyDefinitionInterface $propertyDefinition */ public function addPropertyDefinition(PropertyDefinitionInterface $propertyDefinition) { $this->propertyDefinitions[$propertyDefinition->getId()] = $propertyDefinition; }
/** * Sets the designated parameter to the query name of the given property. * * @param integer $parameterIndex the parameter index (one-based) * @param PropertyDefinitionInterface $propertyDefinition * @throws CmisInvalidArgumentException If property has no query name */ public function setProperty($parameterIndex, PropertyDefinitionInterface $propertyDefinition) { $queryName = $propertyDefinition->getQueryName(); if (empty($queryName)) { throw new CmisInvalidArgumentException('Property has no query name!'); } $this->setParameter($parameterIndex, $this->escape($queryName)); }