public function __get($name)
 {
     switch ($name) {
         case '_ehriMeta':
             if (!isset($this->_meta)) {
                 $criteria = new Criteria();
                 $this->resource->addPropertysCriteria($criteria);
                 $criteria->add(QubitProperty::NAME, "ehrimeta");
                 if (1 == count($query = QubitProperty::get($criteria))) {
                     $this->_meta = $query[0];
                 } else {
                     $this->_meta = new QubitProperty();
                     $this->_meta->name = "ehrimeta";
                     $this->_meta->value = serialize(array());
                     $this->resource->propertys[] = $this->_meta;
                 }
             }
             return $this->_meta;
         case 'ehriCopyrightIssue':
         case 'ehriPriority':
             $meta = unserialize($this->_ehriMeta->value);
             return array_key_exists($name, $meta) ? $meta[$name] : NULL;
         default:
             return parent::__get($name);
     }
 }
Ejemplo n.º 2
0
 public function __set($name, $value)
 {
     $args = func_get_args();
     $options = array();
     if (2 < count($args)) {
         $options = $args[2];
     }
     switch ($name) {
         case 'language':
         case 'script':
             if (!isset($this->values[$name])) {
                 $criteria = new Criteria();
                 $this->addPropertysCriteria($criteria);
                 $criteria->add(QubitProperty::NAME, $name);
                 if (1 == count($query = QubitProperty::get($criteria))) {
                     $this->values[$name] = $query[0];
                 } else {
                     $this->values[$name] = new QubitProperty();
                     $this->values[$name]->name = $name;
                     $this->propertys[] = $this->values[$name];
                 }
             }
             $this->values[$name]->__set('value', serialize($value), $options + array('sourceCulture' => true));
             return $this;
     }
     return call_user_func_array(array($this, 'BaseFunction::__set'), $args);
 }
 protected function property($name)
 {
     if (!isset($this->property[$name])) {
         $criteria = new Criteria();
         $this->resource->addPropertysCriteria($criteria);
         $criteria->add(QubitProperty::NAME, $name);
         if (1 == count($query = QubitProperty::get($criteria))) {
             $this->property[$name] = $query[0];
         } else {
             $this->property[$name] = new QubitProperty();
             $this->property[$name]->name = $name;
             $this->resource->propertys[] = $this->property[$name];
         }
     }
     return $this->property[$name];
 }
Ejemplo n.º 4
0
 public function getProperties($name = null, $scope = null)
 {
     $criteria = new Criteria();
     $criteria->add(QubitProperty::OBJECT_ID, $this->id);
     if ($name) {
         $criteria->add(QubitProperty::NAME, $name);
     }
     if ($scope) {
         $criteria->add(QubitProperty::SCOPE, $scope);
     }
     return QubitProperty::get($criteria);
 }
Ejemplo n.º 5
0
 public static function getpropertysById($id, array $options = array())
 {
     $criteria = new Criteria();
     self::addpropertysCriteriaById($criteria, $id);
     return QubitProperty::get($criteria, $options);
 }