Пример #1
0
 /**
  * @param $data
  * @param $dataToSerialize
  */
 protected function setEmbed($data, $dataToSerialize)
 {
     if (isset($data['tags']['embed']) && isset($data['tags']['collection'])) {
         $filter = new EmbedFilter($this->managerRegistry, $this->propertyAccessor);
         $item = $dataToSerialize->getIterator()->current();
         if (null === ($params = $this->apiResource->getRouteKeyParams($item))) {
             $params['id'] = $this->propertyAccessor->getValue($item, 'id');
         }
         $params['embed'] = $this->apiResource->getShortName();
         $filter->setParameters($params);
         $filter->setRouteName($data['routeName']);
         $this->apiResource->addFilter($filter);
     }
 }