/** * @ORM\PrePersist */ public function createAccount() { if (!$this->account) { $this->account = new Account(); $this->account->setOrganization($this->organization); $this->account->setName(sprintf('%s %s', $this->firstName, $this->lastName)); if ($this->getOwner() && !$this->account->getOwner()) { $this->account->setOwner($this->getOwner(), false); } } }