Exemple #1
0
 /**
  * {@inheritdoc}
  */
 public function handle(Column $column, Entity $entity = null, array $options = array())
 {
     $value = $entity->get($column->getName(), $options['path']);
     return new Cell(new Data($this->formatter->format($value, $options)));
 }
Exemple #2
0
 /**
  * Substitute URL placeholders with entity properties value.
  *
  * @param string $pattern
  * @param Entity $entity
  *
  * @return string
  */
 private function resolveEntityUrl($pattern, Entity $entity)
 {
     return preg_replace_callback('~\\{([\\w]+)\\}~', function (array $matches) use($entity) {
         return $entity->get($matches[1]);
     }, $pattern);
 }
Exemple #3
0
 public function testId()
 {
     $data = array('property' => 'value');
     $entity = new Entity($data, PropertyAccess::getPropertyAccessor(), array(), 'property');
     $this->assertEquals('value', $entity->getId());
 }