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