/**
  * @param array $convertedItem
  *
  * @return FamilyInterface
  */
 protected function findOrCreateFamily(array $convertedItem)
 {
     $family = $this->findObject($this->repository, $convertedItem);
     if (null === $family) {
         return $this->familyFactory->createFamily();
     }
     return $family;
 }
 /**
  * Create a family
  *
  * @Template
  * @AclAncestor("pim_enrich_family_create")
  *
  * @return array
  */
 public function createAction()
 {
     if (!$this->getRequest()->isXmlHttpRequest()) {
         return $this->redirectToRoute('pim_enrich_family_index');
     }
     $family = $this->familyFactory->createFamily();
     if ($this->familyHandler->process($family)) {
         $this->addFlash('success', 'flash.family.created');
         $response = ['status' => 1, 'url' => $this->generateUrl('pim_enrich_family_edit', ['id' => $family->getId()])];
         return new Response(json_encode($response));
     }
     return ['form' => $this->familyForm->createView()];
 }
 /**
  * {@inheritdoc}
  */
 protected function createEntity($class, array $data)
 {
     return $this->factory->createFamily();
 }