vendor/jackalope/jackalope/src/Jackalope/NodeType/PropertyDefinition.php line 17

Open in your IDE?
  1. <?php
  2. namespace Jackalope\NodeType;
  3. use PHPCR\NodeType\PropertyDefinitionInterface;
  4. /**
  5.  * {@inheritDoc}
  6.  *
  7.  * TODO: document array format of constructor
  8.  *
  9.  * @license http://www.apache.org/licenses Apache License Version 2.0, January 2004
  10.  * @license http://opensource.org/licenses/MIT MIT License
  11.  *
  12.  * @api
  13.  */
  14. class PropertyDefinition extends ItemDefinition implements PropertyDefinitionInterface
  15. {
  16.     /**
  17.      * One of the PropertyType type constants
  18.      * @var int
  19.      */
  20.     protected $requiredType;
  21.     /**
  22.      * The constraint information array (array of strings)
  23.      * @var array
  24.      */
  25.     protected $valueConstraints = [];
  26.     /**
  27.      * @var mixed
  28.      */
  29.     protected $defaultValues = [];
  30.     /**
  31.      * @var boolean
  32.      */
  33.     protected $isMultiple;
  34.     /**
  35.      * List of constants from \PHPCR\Query\QueryObjectModelConstantsInterface
  36.      *
  37.      * @var array
  38.      */
  39.     protected $availableQueryOperators = [];
  40.     /**
  41.      * @var boolean
  42.      */
  43.     protected $isFullTextSearchable;
  44.     /**
  45.      * @var boolean
  46.      */
  47.     protected $isQueryOrderable;
  48.     /**
  49.      * Treat more information in addition to ItemDefinition::fromArray()
  50.      *
  51.      * See class documentation for the fields supported in the array.
  52.      *
  53.      * @param array $data The property definition in array form.
  54.      */
  55.     protected function fromArray(array $data)
  56.     {
  57.         parent::fromArray($data);
  58.         $this->requiredType $data['requiredType'];
  59.         $this->isMultiple = isset($data['multiple']) ? $data['multiple'] : false;
  60.         $this->isFullTextSearchable = isset($data['fullTextSearchable']) ? $data['fullTextSearchable'] : false;
  61.         $this->isQueryOrderable = isset($data['queryOrderable']) ? $data['queryOrderable'] : false;
  62.         $this->valueConstraints = isset($data['valueConstraints']) ? $data['valueConstraints'] : [];
  63.         $this->availableQueryOperators = isset($data['availableQueryOperators']) ? $data['availableQueryOperators'] : [];
  64.         $this->defaultValues = isset($data['defaultValues']) ? $data['defaultValues'] : [];
  65.     }
  66.     /**
  67.      * {@inheritDoc}
  68.      *
  69.      * @api
  70.      */
  71.     public function getRequiredType()
  72.     {
  73.         return $this->requiredType;
  74.     }
  75.     /**
  76.      * {@inheritDoc}
  77.      *
  78.      * @api
  79.      */
  80.     public function getValueConstraints()
  81.     {
  82.         return $this->valueConstraints;
  83.     }
  84.     /**
  85.      * {@inheritDoc}
  86.      *
  87.      * @api
  88.      */
  89.     public function getDefaultValues()
  90.     {
  91.         return $this->defaultValues;
  92.     }
  93.     /**
  94.      * {@inheritDoc}
  95.      *
  96.      * @api
  97.      */
  98.     public function isMultiple()
  99.     {
  100.         return $this->isMultiple;
  101.     }
  102.     /**
  103.      * {@inheritDoc}
  104.      *
  105.      * @api
  106.      */
  107.     public function getAvailableQueryOperators()
  108.     {
  109.         return $this->availableQueryOperators;
  110.     }
  111.     /**
  112.      * {@inheritDoc}
  113.      *
  114.      * @api
  115.      */
  116.     public function isFullTextSearchable()
  117.     {
  118.         return $this->isFullTextSearchable;
  119.     }
  120.     /**
  121.      * {@inheritDoc}
  122.      *
  123.      * @api
  124.      */
  125.     public function isQueryOrderable()
  126.     {
  127.         return $this->isQueryOrderable;
  128.     }
  129. }