Last active
December 31, 2015 22:49
-
-
Save fdewinne/8055726 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add email | |
* | |
* @param \Application\Entity\Email $email | |
* @return User | |
*/ | |
public function addEmail(\Application\Entity\Email $email) | |
{ | |
if (!$this->emails->contains($email)) { | |
$email->setUser($this); | |
$this->emails->add($email); | |
} | |
return $this; | |
} | |
/** | |
* Add emails | |
* | |
* @param Collection $emails | |
* | |
* @return $this | |
*/ | |
public function addEmails(Collection $emails) | |
{ | |
foreach ($emails as $email) { | |
$this->addEmail($email); | |
} | |
return $this; | |
} | |
/** | |
* Remove emails | |
* | |
* @param \Application\Entity\Email $emails | |
*/ | |
public function removeEmail(\Application\Entity\Email $emails) | |
{ | |
$this->emails->removeElement($emails); | |
} | |
public function removeEmails(Collection $emails) | |
{ | |
foreach ($emails as $email) { | |
$this->removeEmail($email); | |
} | |
return $this; | |
} | |
/** | |
* Get emails | |
* | |
* @return \Doctrine\Common\Collections\Collection | |
*/ | |
public function getEmails() | |
{ | |
return $this->emails; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment