Example #1
0
 public function extract($object)
 {
     $data = parent::extract($object);
     // provide the fieldset access to the entity
     // (since it is changing properties of the user)
     $data['passwordFieldset'] = $object;
     return $data;
 }
 /**
  * Extract values (including the configured FreeValues) from an TemplateValues entity.
  *
  * @param TemplateValues $object
  *
  * @return array
  */
 public function extract($object)
 {
     $data = parent::extract($object);
     foreach ($this->getFreeValuesKeys() as $key) {
         $data[$key] = $object->get($key);
     }
     return $data;
 }
 public function extract($object)
 {
     $controllerPluginManager = $this->serviceManager->get('controllerPluginManager');
     $data = parent::extract($object);
     $viewLink = $controllerPluginManager->get('url')->fromRoute('lang/jobs/view', array(), array('query' => array('id' => $data['id'])));
     $data['previewLink'] = $viewLink;
     return $data;
 }
Example #4
0
 /**
  * Inherit data from an {@link UserInfoInterface}.
  *
  * Copies the user image to an application attachment.
  * @param InfoInterface $info
  * @return $this
  */
 public function inherit(InfoInterface $info)
 {
     $hydrator = new EntityHydrator();
     $imageStrategy = new FileCopyStrategy(new Attachment());
     $hydrator->addStrategy('image', $imageStrategy);
     $data = $hydrator->extract($info);
     $hydrator->hydrate($data, $this);
     return $this;
 }
Example #5
0
 public function extract($object)
 {
     $data = parent::extract($object);
     $data['description-description'] = $this->extractValue('descriptiondescription', $object);
     $data['description-requirements'] = $this->extractValue('descriptionrequirements', $object);
     $data['description-benefits'] = $this->extractValue('descriptionbenefits', $object);
     $data['description-qualifications'] = $this->extractValue('descriptionqualifications', $object);
     $data['description-title'] = $this->extractValue('descriptiontitle', $object);
     return $data;
 }
Example #6
0
 /**
  * makes a recursiv difference between array1 and array2
  * found commands like  'array_diff_assoc' wanting
  *
  * the result looks like
  * key => array( old, new)
  * in subarrays it looks like
  * key.subkey = array( old, new)
  *
  * @param $array1
  * @param $array2
  * @param int $maxDepth
  * @return array
  */
 protected function array_compare($array1, $array2, $maxDepth = 2)
 {
     $result = array();
     $arraykeys = array_unique(array_merge(array_keys($array1), array_keys($array2)));
     foreach ($arraykeys as $key) {
         if (!empty($key) && is_string($key) && $key[0] != "" && substr($key, 0, 8) != 'Doctrine') {
             if (array_key_exists($key, $array1) && !array_key_exists($key, $array2)) {
                 $result[$key] = array($array1[$key], '');
             }
             if (!array_key_exists($key, $array1) && array_key_exists($key, $array2)) {
                 $result[$key] = array('', $array2[$key]);
             }
             if (array_key_exists($key, $array1) && array_key_exists($key, $array2)) {
                 $subResult = null;
                 if (is_array($array1[$key]) && is_array($array2[$key])) {
                     if (0 < $maxDepth) {
                         $subResult = $this->array_compare($array1[$key], $array2[$key], $maxDepth - 1);
                     }
                 } elseif (is_object($array1[$key]) && is_object($array2[$key])) {
                     if (0 < $maxDepth) {
                         $hydrator = new EntityHydrator();
                         $a1 = $hydrator->extract($array1[$key]);
                         $a2 = $hydrator->extract($array2[$key]);
                         $subResult = $this->array_compare($a1, $a2, $maxDepth - 1);
                     }
                 } else {
                     if ($array1[$key] != $array2[$key]) {
                         $result[$key] = array($array1[$key], $array2[$key]);
                     }
                 }
                 if (!empty($subResult)) {
                     foreach ($subResult as $subKey => $subValue) {
                         if (!empty($subKey) && is_string($subKey)) {
                             $result[$key . '.' . $subKey] = $subValue;
                         }
                     }
                 }
             }
         }
     }
     return $result;
 }