Example #1
0
 public function __construct($rawData, $path, $session, $objectManager)
 {
     parent::__construct($rawData, $path, $session, $objectManager);
     $this->isNode = true;
     //TODO: determine the index if != 1
     foreach ($rawData as $key => $value) {
         if (is_object($value)) {
             array_push($this->nodes, $key);
         } else {
             if (0 === strpos($key, ':')) {
                 continue;
             }
             //It's a property type
             switch ($key) {
                 case 'jcr:index':
                     $this->index = $value;
                     break;
                 case 'jcr:primaryType':
                     $this->primaryType = $value;
                     $this->properties[$key] = jackalope_Factory::get('Property', array(array('type' => $rawData->{':jcr:primaryType'}, 'value' => $value), $this->getPath() . '/jcr:primaryType', $this->session, $this->objectManager));
                     break;
                 case 'jcr:uuid':
                     $this->uuid = $value;
                     break;
                     //TODO: more special information?
                 //TODO: more special information?
                 default:
                     $type = isset($rawData->{':' . $key}) ? $rawData->{':' . $key} : 'undefined';
                     $this->properties[$key] = jackalope_Factory::get('Property', array(array('type' => $type, 'value' => $value), $this->getPath() . '/' . $key, $this->session, $this->objectManager));
                     break;
             }
         }
     }
 }
Example #2
0
 public function __construct($data, $path, jackalope_Session $session, jackalope_ObjectManager $objectManager)
 {
     parent::__construct(null, $path, $session, $objectManager);
     $this->type = PHPCR_PropertyType::valueFromName($data['type']);
     if (is_array($data['value'])) {
         $this->isMultiple = true;
         $this->value = array();
         foreach ($data['value'] as $value) {
             array_push($this->value, jackalope_Factory::get('Value', array($data['type'], $value)));
         }
     } else {
         $this->value = jackalope_Factory::get('Value', array($data['type'], $data['value']));
     }
 }