public function renderBlock(\Twig_Template $template, ColumnInterface $column, $object, $context, $blocks)
 {
     try {
         $value = $this->accessor->getValue($object, $column->getName());
     } catch (ExceptionInterface $exception) {
         $value = null;
     }
     $block = 'crudify_field_' . $column->getType();
     // check if the block exists
     $hasBlock = false;
     if (!isset($blocks[$block])) {
         $current = $template;
         do {
             if ($current->hasBlock($block)) {
                 break;
             }
             $current = $current->getParent($context);
         } while ($current instanceof \Twig_Template);
         if ($current instanceof \Twig_Template) {
             $hasBlock = true;
         }
     } else {
         $hasBlock = true;
     }
     if ($hasBlock) {
         $context['value'] = $value;
         $context['definition'] = $column->getParent()->getParent();
         $context['column'] = $column;
         $context['object'] = $object;
         $result = $template->renderBlock($block, $context, $blocks);
     } else {
         $result = htmlspecialchars((string) $value, ENT_QUOTES | ENT_SUBSTITUTE, 'utf-8');
     }
     return $result;
 }
 function it_should_add_multiple_columns_at_the_end_of_the_list(ColumnInterface $first, ColumnInterface $second, ColumnInterface $third)
 {
     $first->getName()->willReturn('first');
     $first->setParent($this)->willReturn();
     $second->getName()->willReturn('second');
     $second->setParent($this)->willReturn();
     $third->getName()->willReturn('third');
     $third->setParent($this)->willReturn();
     $this->addColumn($first);
     $this->addColumn($second);
     $this->addColumn($third);
     $this->getColumns()->shouldHaveCount(3);
     $this->getColumns()->shouldReturn([$first, $second, $third]);
     $this->hasColumn('first')->shouldReturn(true);
     $this->hasColumn('second')->shouldReturn(true);
     $this->hasColumn('third')->shouldReturn(true);
 }