1 <?php 
declare(strict_types
=1); 
   4  * This file is part of the Rapsys AirBundle package. 
   6  * (c) Raphaël Gertz <symfony@rapsys.eu> 
   8  * For the full copyright and license information, please view the LICENSE 
   9  * file that was distributed with this source code. 
  12 namespace Rapsys\AirBundle\Entity
; 
  14 use Doctrine\Common\Collections\ArrayCollection
; 
  15 use Doctrine\ORM\Event\PreUpdateEventArgs
; 
  52          * @var ArrayCollection 
  59          * @param string $code The country code 
  60          * @param string $alpha The country alpha 
  61          * @param string $title The country title 
  63         public function __construct(string $code, string $alpha, string $title) { 
  66                 $this->alpha 
= $alpha; 
  67                 $this->title 
= $title; 
  68                 $this->created 
= new \
DateTime('now'); 
  69                 $this->updated 
= new \
DateTime('now'); 
  72                 $this->users 
= new ArrayCollection(); 
  80         public function getId(): int { 
  91         public function setCode(string $code): Country 
{ 
 102         public function getCode(): string { 
 109          * @param string $alpha 
 113         public function setAlpha(string $alpha): Country 
{ 
 114                 $this->alpha 
= $alpha; 
 124         public function getAlpha(): string { 
 131          * @param string $title 
 135         public function setTitle(string $title): Country 
{ 
 136                 $this->title 
= $title; 
 146         public function getTitle(): string { 
 153          * @param \DateTime $created 
 157         public function setCreated(\DateTime 
$created): Country 
{ 
 158                 $this->created 
= $created; 
 168         public function getCreated(): \DateTime 
{ 
 169                 return $this->created
; 
 175          * @param \DateTime $updated 
 179         public function setUpdated(\DateTime 
$updated): Country 
{ 
 180                 $this->updated 
= $updated; 
 190         public function getUpdated(): \DateTime 
{ 
 191                 return $this->updated
; 
 201         public function addUser(User 
$user): User 
{ 
 202                 $this->users
[] = $user; 
 212         public function removeUser(User 
$user): bool { 
 213                 return $this->users
->removeElement($user); 
 219          * @return ArrayCollection 
 221         public function getUsers(): ArrayCollection 
{ 
 228         public function preUpdate(PreUpdateEventArgs 
$eventArgs) { 
 229                 //Check that we have an country instance 
 230                 if (($country = $eventArgs->getEntity()) instanceof Country
) { 
 232                         $country->setUpdated(new \
DateTime('now')); 
 237          * Returns a string representation of the country 
 241         public function __toString(): string {