/**
  * {@inheritdoc}
  *
  * @return Category
  */
 protected function createEntity(array $data)
 {
     $category = new Category();
     $category->setCode($data['code']);
     foreach ($this->getLabels($data) as $locale => $label) {
         $translation = $category->getTranslation($locale);
         $translation->setLabel($label);
         $category->addTranslation($translation);
     }
     if ($data['parent']) {
         $parent = new Category();
         $parent->setCode($data['parent']);
         $category->setParent($parent);
     }
     return $category;
 }
 /**
  * {@inheritDoc}
  */
 public function getTranslation($locale = NULL)
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getTranslation', array($locale));
     return parent::getTranslation($locale);
 }