Ejemplo n.º 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)));
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 3
0
 public function testId()
 {
     $data = array('property' => 'value');
     $entity = new Entity($data, PropertyAccess::getPropertyAccessor(), array(), 'property');
     $this->assertEquals('value', $entity->getId());
 }