Example #1
0
 /**
  * {@inheritDoc}
  */
 public function writeProperty(&$objectOrArray)
 {
     $isReference = false;
     // If the data is identical to the value in $objectOrArray, we are
     // dealing with a reference
     if ($this->getPropertyPath() !== null) {
         $isReference = $this->getData() === $this->getPropertyPath()->getValue($objectOrArray);
     }
     // Don't write into $objectOrArray if $objectOrArray is an object,
     // $isReference is true (see above) and the option "by_reference" is
     // true as well
     if (!is_object($objectOrArray) || !$isReference || !$this->getOption('by_reference')) {
         parent::writeProperty($objectOrArray);
     }
 }
Example #2
0
 /**
  * {@inheritDoc}
  */
 public function writeProperty(&$objectOrArray)
 {
     $data = $this->getData();
     // Don't update parent if data is a composite type (object or array)
     // and "by_reference" option is true, because then we expect that
     // we are working with a reference to the parent's data
     if (!(is_object($data) || is_array($data)) || !$this->getOption('by_reference')) {
         parent::writeProperty($objectOrArray);
     }
 }