Skip to content

Instantly share code, notes, and snippets.

@fdewinne
Last active December 31, 2015 22:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fdewinne/8055726 to your computer and use it in GitHub Desktop.
Save fdewinne/8055726 to your computer and use it in GitHub Desktop.
<?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