Пример #1
0
 /**
  * @return mixed
  */
 public function toArray()
 {
     $out = [];
     foreach ($this->properties->getValues() as $v) {
         if ($v->isVisible()) {
             $v->addToArray($out);
         }
     }
     return $out;
 }
Пример #2
0
 /**
  * @param ResourceTransformer $transformer
  * @param $original
  * @param PropertyValues $identifiers
  * @param Context $context
  * @return bool
  */
 protected function entityEquals(ResourceTransformer $transformer, $original, PropertyValues $identifiers, Context $context)
 {
     if (count($identifiers->getValues()) === 0) {
         return false;
     }
     foreach ($identifiers->getValues() as $identifier) {
         $path = $this->splitPathParameters($identifier->getField()->getName());
         $propertyValue = $this->resolveChildPath($transformer, $original, $path, $identifier->getField(), $context);
         if (!$identifier->equals($propertyValue)) {
             return false;
         }
     }
     return true;
 }