/**
  * @param ContentTypeInterface $contentType
  *
  * @return FacadeInterface
  *
  * @throws TransformerParameterTypeException
  */
 public function transform($contentType)
 {
     if (!$contentType instanceof ContentTypeInterface) {
         throw new TransformerParameterTypeException();
     }
     $facade = $this->newFacade();
     $facade->id = $contentType->getId();
     $facade->contentTypeId = $contentType->getContentTypeId();
     $facade->name = $this->multiLanguagesChoiceManager->choose($contentType->getNames());
     $facade->version = $contentType->getVersion();
     $facade->linkedToSite = $contentType->isLinkedToSite();
     if ($this->hasGroup(CMSGroupContext::FIELD_TYPES)) {
         foreach ($contentType->getFields() as $field) {
             $facade->addField($this->getTransformer('field_type')->transform($field));
         }
     }
     $facade->addLink('_self', $this->generateRoute('open_orchestra_api_content_type_show', array('contentTypeId' => $contentType->getContentTypeId())));
     if (0 == $this->contentRepository->countByContentType($contentType->getContentTypeId()) && $this->authorizationChecker->isGranted(AdministrationPanelStrategy::ROLE_ACCESS_DELETE_CONTENT_TYPE)) {
         $facade->addLink('_self_delete', $this->generateRoute('open_orchestra_api_content_type_delete', array('contentTypeId' => $contentType->getContentTypeId())));
     }
     if ($this->authorizationChecker->isGranted(AdministrationPanelStrategy::ROLE_ACCESS_UPDATE_CONTENT_TYPE)) {
         $facade->addLink('_self_form', $this->generateRoute('open_orchestra_backoffice_content_type_form', array('contentTypeId' => $contentType->getContentTypeId())));
     }
     return $facade;
 }