addMembership() публичный Метод

public addMembership ( PlaysInTeam $playsInTeam )
$playsInTeam PlaysInTeam
Пример #1
0
 public function addToTeam(Team $team, $timestamp = null)
 {
     if (null !== $this->playsIn) {
         throw new \InvalidArgumentException('You must remove the current membership before adding a new one');
     }
     $dt = new \DateTime('NOW', new \DateTimeZone('UTC'));
     $time = null !== $timestamp ? $timestamp : $dt->getTimestamp();
     $membership = new PlaysInTeam($this, $team, $time);
     $this->playsIn = $membership;
     $team->addMembership($membership);
 }