/** * {@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))); }
/** * 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); }
public function testMapping() { $data = array('property' => 'value'); $entity = new Entity($data, PropertyAccess::getPropertyAccessor(), array('anything' => 'property')); $this->assertEquals('value', $entity->get('anything')); }