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\ORM\Event\PreUpdateEventArgs
; 
  23         private ?int $id = null; 
  28         private ?string $description = null; 
  33         private ?string $class = null; 
  38         private ?string $short = null; 
  43         private ?int $rate = null; 
  48         private ?bool $hat = null; 
  53         private ?string $contact = null; 
  58         private ?string $donate = null; 
  63         private ?string $link = null; 
  68         private ?string $profile = null; 
  73         private \DateTime 
$created; 
  78         private \DateTime 
$updated; 
  83          * @param string $locale The locale 
  84          * @param Location $location The location instance 
  85          * @param User $user The user instance 
  87         public function __construct(private string $locale, private Location 
$location, private User 
$user) { 
  89                 $this->created 
= new \
DateTime('now'); 
  90                 $this->updated 
= new \
DateTime('now'); 
  98         public function getId(): ?int { 
 105          * @param string $locale 
 109         public function setLocale(string $locale): Snippet 
{ 
 110                 $this->locale 
= $locale; 
 120         public function getLocale(): string { 
 121                 return $this->locale
; 
 127          * @param string $description 
 131         public function setDescription(?string $description): Snippet 
{ 
 132                 $this->description 
= $description; 
 142         public function getDescription(): ?string { 
 143                 return $this->description
; 
 149          * @param string $class 
 153         public function setClass(?string $class): Snippet 
{ 
 154                 $this->class = $class; 
 164         public function getClass(): ?string { 
 171          * @param string $short 
 175         public function setShort(?string $short): Snippet 
{ 
 176                 $this->short 
= $short; 
 186         public function getShort(): ?string { 
 197         public function setRate(?int $rate): Snippet 
{ 
 208         public function getRate(): ?int { 
 219         public function setHat(?bool $hat): Snippet 
{ 
 230         public function getHat(): ?bool { 
 236          * @param string $contact 
 240         public function setContact(?string $contact): Snippet 
{ 
 241                 $this->contact 
= $contact; 
 251         public function getContact(): ?string { 
 252                 return $this->contact
; 
 258          * @param string $donate 
 262         public function setDonate(?string $donate): Snippet 
{ 
 263                 $this->donate 
= $donate; 
 273         public function getDonate(): ?string { 
 274                 return $this->donate
; 
 280          * @param string $link 
 284         public function setLink(?string $link): Snippet 
{ 
 295         public function getLink(): ?string { 
 302          * @param string $profile 
 306         public function setProfile(?string $profile): Snippet 
{ 
 307                 $this->profile 
= $profile; 
 317         public function getProfile(): ?string { 
 318                 return $this->profile
; 
 324          * @param \DateTime $created 
 328         public function setCreated(\DateTime 
$created): Snippet 
{ 
 329                 $this->created 
= $created; 
 339         public function getCreated(): \DateTime 
{ 
 340                 return $this->created
; 
 346          * @param \DateTime $updated 
 350         public function setUpdated(\DateTime 
$updated): Snippet 
{ 
 351                 $this->updated 
= $updated; 
 361         public function getUpdated(): \DateTime 
{ 
 362                 return $this->updated
; 
 368          * @param Location $location 
 372         public function setLocation(Location 
$location): Snippet 
{ 
 373                 $this->location 
= $location; 
 383         public function getLocation(): Location 
{ 
 384                 return $this->location
; 
 394         public function setUser(User 
$user): Snippet 
{ 
 405         public function getUser(): User 
{ 
 412         public function preUpdate(PreUpdateEventArgs 
$eventArgs) { 
 413                 //Check that we have an snippet instance 
 414                 if (($snippet = $eventArgs->getObject()) instanceof Snippet
) { 
 416                         $snippet->setUpdated(new \
DateTime('now'));