mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
everything changed to datetime
This commit is contained in:
parent
b74f9cf5dc
commit
fb43980a2a
@ -35,9 +35,9 @@ final class AsideActivity implements TrackUpdateInterface, TrackCreationInterfac
|
||||
private \Chill\MainBundle\Entity\User $createdBy;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="datetime_immutable")
|
||||
* @ORM\Column(type="datetime")
|
||||
*/
|
||||
private \DateTimeInterface $createdAt;
|
||||
private $createdAt;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=User::class)
|
||||
@ -45,9 +45,9 @@ final class AsideActivity implements TrackUpdateInterface, TrackCreationInterfac
|
||||
private \Chill\MainBundle\Entity\User $updatedBy;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="datetime_immutable", nullable=true)
|
||||
* @ORM\Column(type="datetime", nullable=true)
|
||||
*/
|
||||
private \DateTimeInterface $updatedAt;
|
||||
private $updatedAt;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity=User::class)
|
||||
@ -57,14 +57,14 @@ final class AsideActivity implements TrackUpdateInterface, TrackCreationInterfac
|
||||
private \Chill\MainBundle\Entity\User $agent;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="datetime_immutable")
|
||||
* @ORM\Column(type="datetime")
|
||||
*/
|
||||
private \DateTimeInterface $date;
|
||||
private $date;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="time", nullable=true)
|
||||
*/
|
||||
private ?\DateTime $duration = null;
|
||||
private ?\DateTimeInterface $duration = null;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=100, nullable=true)
|
||||
@ -165,12 +165,12 @@ final class AsideActivity implements TrackUpdateInterface, TrackCreationInterfac
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDuration(): ?\DateTime
|
||||
public function getDuration(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->duration;
|
||||
}
|
||||
|
||||
public function setDuration(?\DateTime $duration): self
|
||||
public function setDuration(?\DateTimeInterface $duration): self
|
||||
{
|
||||
$this->duration = $duration;
|
||||
|
||||
|
@ -12,7 +12,7 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(schema="chill_asideactivity")
|
||||
*/
|
||||
final class AsideActivityCategory
|
||||
class AsideActivityCategory
|
||||
{
|
||||
/**
|
||||
* @ORM\Id
|
||||
|
@ -55,7 +55,7 @@ final class AsideActivityFormType extends AbstractType
|
||||
->add('date', ChillDateType::class,
|
||||
[
|
||||
'label' => 'date',
|
||||
'data' => new \DateTimeImmutable(),
|
||||
'data' => new \DateTime(),
|
||||
//SETTING RANGE ONLY POSSIBLE WITH WIDGET 'CHOICE' AND NOT 'SINGLE_TEXT'?
|
||||
// 'widget' => 'choice',
|
||||
// 'years' => range(2020, date('Y')),
|
||||
@ -96,13 +96,14 @@ final class AsideActivityFormType extends AbstractType
|
||||
// set the timezone to GMT, and fix the difference between current and GMT
|
||||
// the datetimetransformer will then handle timezone as GMT
|
||||
$timezoneUTC = new \DateTimeZone('GMT');
|
||||
/* @var $data \DateTime */
|
||||
/* @var $data \DateTimeImmutable */
|
||||
$data = $formEvent->getData() === NULL ?
|
||||
\DateTime::createFromFormat('U', 300) :
|
||||
$formEvent->getData();
|
||||
$seconds = $data->getTimezone()->getOffset($data);
|
||||
$data->setTimeZone($timezoneUTC);
|
||||
$data->add(new \DateInterval('PT'.$seconds.'S'));
|
||||
dump($data);
|
||||
|
||||
// test if the timestamp is in the choices.
|
||||
// If not, recreate the field with the new timestamp
|
||||
|
Loading…
x
Reference in New Issue
Block a user