Rapsys Git
/
airbundle
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Rename rapsysair:calendar2 command to rapsysair:calendar
[airbundle]
/
Entity
/
Slot.php
diff --git
a/Entity/Slot.php
b/Entity/Slot.php
index 10e5b3d6f8bb1c48d996be97b4e72f92029328b6..25ef3e8427e642693c058eba7b2cd75d1575f7cf 100644
(file)
--- a/
Entity/Slot.php
+++ b/
Entity/Slot.php
@@
-1,16
+1,17
@@
<?php declare(strict_types=1);
/*
<?php declare(strict_types=1);
/*
- *
this file is part of the rapsys packb
undle package.
+ *
This file is part of the Rapsys AirB
undle package.
*
*
- * (c)
raphaël g
ertz <symfony@rapsys.eu>
+ * (c)
Raphaël G
ertz <symfony@rapsys.eu>
*
*
- *
for the full copyright and license information, please view the license
+ *
For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Rapsys\AirBundle\Entity;
* file that was distributed with this source code.
*/
namespace Rapsys\AirBundle\Entity;
+use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Event\PreUpdateEventArgs;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Event\PreUpdateEventArgs;
@@
-19,34
+20,34
@@
use Doctrine\ORM\Event\PreUpdateEventArgs;
*/
class Slot {
/**
*/
class Slot {
/**
- *
@var integer
+ *
Primary key
*/
*/
- private
$id
;
+ private
?int $id = null
;
/**
/**
- *
@var string
+ *
Create datetime
*/
*/
- pr
otected $title
;
+ pr
ivate \DateTime $created
;
/**
/**
- *
@var \DateT
ime
+ *
Update datet
ime
*/
*/
- private
$cre
ated;
+ private
\DateTime $upd
ated;
/**
/**
- *
@var \DateTime
+ *
Sessions collection
*/
*/
- private $updated;
-
- /**
- * @var ArrayCollection
- */
- private $sessions;
+ private Collection $sessions;
/**
* Constructor
*/
/**
* Constructor
*/
- public function __construct() {
+ public function __construct(private string $title) {
+ //Set defaults
+ $this->created = new \DateTime('now');
+ $this->updated = new \DateTime('now');
+
+ //Set collections
$this->sessions = new ArrayCollection();
}
$this->sessions = new ArrayCollection();
}
@@
-55,7
+56,7
@@
class Slot {
*
* @return integer
*/
*
* @return integer
*/
- public function getId(): int {
+ public function getId():
?
int {
return $this->id;
}
return $this->id;
}
@@
-161,9
+162,9
@@
class Slot {
*/
public function preUpdate(PreUpdateEventArgs $eventArgs) {
//Check that we have a slot instance
*/
public function preUpdate(PreUpdateEventArgs $eventArgs) {
//Check that we have a slot instance
- if (($
user = $eventArgs->getEntity
()) instanceof Slot) {
+ if (($
slot = $eventArgs->getObject
()) instanceof Slot) {
//Set updated value
//Set updated value
- $
user
->setUpdated(new \DateTime('now'));
+ $
slot
->setUpdated(new \DateTime('now'));
}
}
}
}