Jackalope\Property::getValueForStorage PHP Метод

getValueForStorage() публичный Метод

Path and reference properties are not resolved to the node objects. If this is a binary property, from the moment this method has been called the stream will be read from the transport layer again.
public getValueForStorage ( )
    public function getValueForStorage()
    {
        $this->checkState();
        $value = $this->value;
        if (PropertyType::BINARY === $this->type) {
            //from now on,
            $this->value = null;
        }
        return $value;
    }

Usage Example

Пример #1
0
 /**
  * This method is used when building a JSOP of the properties
  *
  * @param $value
  * @param $type
  * @return mixed|string
  */
 protected function propertyToJsopString(Property $property)
 {
     switch ($property->getType()) {
         case PropertyType::DECIMAL:
             return null;
         case PropertyType::DOUBLE:
             return $this->valueConverter->convertType($property->getValueForStorage(), PropertyType::DOUBLE);
         case PropertyType::LONG:
             return $this->valueConverter->convertType($property->getValueForStorage(), PropertyType::LONG);
         case PropertyType::DATE:
         case PropertyType::WEAKREFERENCE:
         case PropertyType::REFERENCE:
         case PropertyType::BINARY:
         case PropertyType::PATH:
         case PropertyType::URI:
             return null;
         case PropertyType::NAME:
             if ($property->getName() != 'jcr:primaryType') {
                 return null;
             }
             break;
     }
     return $property->getValueForStorage();
 }