Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function __construct($data = null, $parent = null, $timezone = null, ODM $odm = null)
 {
     $this->parent = $parent;
     $this->original = $data;
     if ($data instanceof \MongoDate) {
         $this->setTimestamp($data->sec);
         return;
     }
     parent::__construct($data, $parent);
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function __construct($data = null, $parent = null)
 {
     $this->parent = $parent;
     if ($data instanceof \DateTime) {
         parent::__construct(null, DatabaseProvider::DEFAULT_TIMEZONE);
         $this->setTimestamp($data->getTimestamp());
     } else {
         parent::__construct($data, DatabaseProvider::DEFAULT_TIMEZONE);
     }
     if ($this->getTimestamp() === false) {
         //Correcting default values
         $this->setTimestamp(0);
     }
     $this->original = $this->getTimestamp();
 }
Ejemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function __construct($data = null, EntityInterface $parent = null)
 {
     $this->parent = $parent;
     $this->original = $data;
     if ($data instanceof \MongoDate) {
         parent::__construct(null, 'UTC');
         $this->setTimestamp($data->sec);
         return;
     }
     //We are locking timezone to UTC for mongo
     parent::__construct($data, 'UTC');
     if ($data === null || $this->getTimestamp() === false) {
         //Correcting default values
         $this->setTimestamp(0);
     }
 }