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
; 
  19 class GoogleCalendar 
{ 
  23         private ?int $id = null; 
  28         private \DateTime 
$created; 
  33         private \DateTime 
$updated; 
  38          * @param GoogleToken $googleToken The google token 
  39          * @param string $mail The google calendar id 
  40          * @param string $summary The google calendar summary 
  41          * @param \DateTime $synchronized The google calendar last synchronization 
  43         public function __construct(private GoogleToken 
$googleToken, private string $mail, private string $summary, private \DateTime 
$synchronized = new \
DateTime('now')) { 
  45                 $this->created 
= new \
DateTime('now'); 
  46                 $this->updated 
= new \
DateTime('now'); 
  54         public function getId(): ?int { 
  62          * @return GoogleCalendar 
  64         public function setMail(string $mail): GoogleCalendar 
{ 
  75         public function getMail(): string { 
  82          * @param string $summary 
  83          * @return GoogleCalendar 
  85         public function setSummary(string $summary): GoogleCalendar 
{ 
  86                 $this->summary 
= $summary; 
  96         public function getSummary(): string { 
  97                 return $this->summary
; 
 103          * @param \DateTime $synchronized 
 105          * @return GoogleCalendar 
 107         public function setSynchronized(\DateTime 
$synchronized): GoogleCalendar 
{ 
 108                 $this->synchronized 
= $synchronized; 
 118         public function getSynchronized(): \DateTime 
{ 
 119                 return $this->synchronized
; 
 125          * @param \DateTime $created 
 127          * @return GoogleCalendar 
 129         public function setCreated(\DateTime 
$created): GoogleCalendar 
{ 
 130                 $this->created 
= $created; 
 140         public function getCreated(): \DateTime 
{ 
 141                 return $this->created
; 
 147          * @param \DateTime $updated 
 149          * @return GoogleCalendar 
 151         public function setUpdated(\DateTime 
$updated): GoogleCalendar 
{ 
 152                 $this->updated 
= $updated; 
 162         public function getUpdated(): \DateTime 
{ 
 163                 return $this->updated
; 
 169          * @param \Rapsys\AirBundle\Entity\GoogleToken $googleToken 
 171          * @return GoogleCalendar 
 173         public function setGoogleToken(GoogleToken 
$googleToken): GoogleCalendar 
{ 
 174                 $this->googleToken 
= $googleToken; 
 182          * @return \Rapsys\AirBundle\Entity\GoogleToken 
 184         public function getGoogleToken(): GoogleToken 
{ 
 185                 return $this->googleToken
; 
 191         public function preUpdate(PreUpdateEventArgs 
$eventArgs): ?GoogleCalendar 
{ 
 192                 //Check that we have an snippet instance 
 193                 if (($entity = $eventArgs->getObject()) instanceof GoogleCalendar
) { 
 195                         return $entity->setUpdated(new \
DateTime('now'));