]> Raphaƫl G. Git Repositories - airbundle/blobdiff - Entity/Slot.php
Use getObject event args member function instead of deprecated getEntity
[airbundle] / Entity / Slot.php
index c5fcd86771529d784deea742fc2c368fb4253755..445f053da023dd3f7d4e0bf9cec050a2ebc0c6a4 100644 (file)
@@ -47,6 +47,9 @@ class Slot {
         * Constructor
         */
        public function __construct() {
         * Constructor
         */
        public function __construct() {
+               //Set defaults
+               $this->created = new \DateTime('now');
+               $this->updated = new \DateTime('now');
                $this->sessions = new ArrayCollection();
        }
 
                $this->sessions = new ArrayCollection();
        }
 
@@ -161,7 +164,7 @@ 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 (($slot = $eventArgs->getEntity()) instanceof Slot) {
+               if (($slot = $eventArgs->getObject()) instanceof Slot) {
                        //Set updated value
                        $slot->setUpdated(new \DateTime('now'));
                }
                        //Set updated value
                        $slot->setUpdated(new \DateTime('now'));
                }