Set parent.
public setParent ( Sulu\Bundle\ContactBundle\Entity\AccountInterface $parent = null ) : Account | ||
$parent | Sulu\Bundle\ContactBundle\Entity\AccountInterface | |
return | Account |
/** * Set parent to account. * * @param array $parentData * @param AccountInterface $account * * @throws \Sulu\Component\Rest\Exception\EntityNotFoundException */ private function setParent($parentData, AccountInterface $account) { if ($parentData != null && isset($parentData['id']) && $parentData['id'] != 'null' && $parentData['id'] != '') { $parent = $this->getDoctrine()->getRepository($this->getAccountEntityName())->findAccountById($parentData['id']); if (!$parent) { throw new EntityNotFoundException($this->getAccountEntityName(), $parentData['id']); } $account->setParent($parent); } else { $account->setParent(null); } }