/**
  * {@inheritdoc}
  */
 public function normalize($object, $format = null, array $context = [])
 {
     $data = ['id' => $object->getId(), 'code' => $object->getCode()];
     if (null !== ($label = $this->renderer->render($object, false))) {
         $data[$this->renderer->getLabelProperty($object)] = $label;
     }
     return $data;
 }
 /**
  * Returns the labels corresponding to the given value
  *
  * @param mixed $value
  *
  * @return array
  */
 public function getOptions($value)
 {
     if ($this->options['multiple']) {
         $options = [];
         foreach ($value as $row) {
             $options[] = ['id' => $row->getId(), 'text' => $this->renderer->render($row)];
         }
         return $options;
     }
     return $value ? ['id' => $value->getId(), 'text' => $this->renderer->render($value)] : null;
 }