/**
* @var \DateTime
*/
- private ?\DateTime $synchronized;
+ private \DateTime $synchronized;
/**
* @var \DateTime
* @param \Rapsys\AirBundle\Entity\GoogleToken $googleToken The google token
* @param string $mail The google calendar id
* @param string $summary The google calendar summary
- * @param ?\DateTime $synchronized The google calendar last synchronization
+ * @param \DateTime $synchronized The google calendar last synchronization
*/
- public function __construct(GoogleToken $googleToken, string $mail, string $summary, ?\DateTime $synchronized = null) {
+ public function __construct(GoogleToken $googleToken, string $mail, string $summary, \DateTime $synchronized = new \DateTime('now')) {
//Set defaults
$this->googleToken = $googleToken;
$this->mail = $mail;
/**
* Set synchronized
*
- * @param ?\DateTime $synchronized
+ * @param \DateTime $synchronized
*
* @return GoogleCalendar
*/
- public function setSynchronized(?\DateTime $synchronized = null): GoogleCalendar {
+ public function setSynchronized(\DateTime $synchronized): GoogleCalendar {
$this->synchronized = $synchronized;
return $this;
/**
* Get synchronized
*
- * @return ?\DateTime
+ * @return \DateTime
*/
- public function getSynchronized(): ?\DateTime {
+ public function getSynchronized(): \DateTime {
return $this->synchronized;
}
*/
public function preUpdate(PreUpdateEventArgs $eventArgs): ?GoogleCalendar {
//Check that we have an snippet instance
- if (($entity = $eventArgs->getEntity()) instanceof GoogleCalendar) {
+ if (($entity = $eventArgs->getObject()) instanceof GoogleCalendar) {
//Set updated value
return $entity->setUpdated(new \DateTime('now'));
}