customerFamily = $customerFamily; } else { $this->customerFamily = new CustomerFamily(); } } /** * @param CustomerFamily $customerFamily * @return $this */ public function setCustomerFamily(CustomerFamily $customerFamily) { $this->customerFamily = $customerFamily; return $this; } /** * @return CustomerFamily */ public function getCustomerFamily() { return $this->customerFamily; } /** * @return int */ public function getId() { return $this->customerFamily->getId(); } /** * @return string */ public function getCode() { return $this->customerFamily->getCode(); } /** * @param string $code * @return $this */ public function setCode($code) { $this->customerFamily->setCode($code); return $this; } /** * @param $locale * @return string */ public function getTitle($locale = null) { if ($locale === null) { $locale = $this->customerFamily->getLocale(); } $this->customerFamily->setLocale($locale); return $this->customerFamily->getTitle(); } /** * @param $title * @param null $locale * @return $this */ public function setTitle($title, $locale = null) { if ($locale === null) { $locale = $this->customerFamily->getLocale(); } $this->customerFamily->setLocale($locale); $this->customerFamily->setTitle($title); return $this; } /** * @param Form $form */ public function hydrateByForm(Form $form) { //code if ($form->get('code') !== null) { self::setCode($form->get('code')->getData()); } //title if ($form->get('title') !== null && $form->get('locale') !== null) { self::setTitle($form->get('title')->getData(), $form->get('locale')->getData()); } } }