<?php
namespace App\Entity;
use App\Repository\FormationRegistrationRepository;
use DateTime;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=FormationRegistrationRepository::class)
* @ORM\HasLifecycleCallbacks()
*/
class FormationRegistration
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity=User::class, inversedBy="formations")
* @ORM\JoinColumn(nullable=false)
*/
private $User;
/**
* @ORM\ManyToOne(targetEntity=Formation::class, inversedBy="registration")
* @ORM\JoinColumn(name="formation_id",referencedColumnName="id",onDelete="CASCADE",nullable=false)
*/
private $formation;
/**
* @ORM\Column(type="datetime", nullable=true, options={"default": "CURRENT_TIMESTAMP"})
*/
private $createdAt;
/**
* @ORM\Column(type="datetime", nullable=true, options={"default": "CURRENT_TIMESTAMP"})
*/
private $updatedAt;
/**
* @ORM\Column(type="integer")
*/
private $viewed=0;
/**
* @ORM\Column(type="datetime", nullable=true, options={"default": "CURRENT_TIMESTAMP"})
*/
private $viewedAt;
/**
* @ORM\Column(type="integer")
*/
private $opened=0;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $openedAt;
/**
* @ORM\Column(type="integer",options={"default": 1})
*/
private $visible=1;
/**
* @ORM\Column(type="integer",options={"default": 1})
*/
private $emailSent=0;
public function getId(): ?int
{
return $this->id;
}
public function getUser(): ?User
{
return $this->User;
}
public function setUser(?User $User): self
{
$this->User = $User;
return $this;
}
public function getFormation(): ?Formation
{
return $this->formation;
}
public function setFormation(?Formation $formation): self
{
$this->formation = $formation;
return $this;
}
public function getUpdatedAt() :?DateTime
{
return $this->updatedAt;
}
public function setUpdatedAt(DateTime $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
public function getCreatedAt() :?DateTime
{
return $this->createdAt;
}
public function setCreatedAt(DateTime $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
/**
* @ORM\PrePersist
* @ORM\PreUpdate
*/
public function updatedTimestamps(): void
{
$dateTimeNow = new \DateTime("now", new \DateTimeZone("Europe/Paris"));
$this->setUpdatedAt($dateTimeNow);
if ($this->getCreatedAt() === null) {
$this->setCreatedAt($dateTimeNow);
}
}
/**
* @return mixed
*/
public function getViewed()
{
return $this->viewed;
}
/**
* @param mixed $viewed
*/
public function setViewed($viewed): void
{
$this->viewed = $viewed;
}
/**
* @return mixed
*/
public function getViewedAt()
{
return $this->viewedAt;
}
/**
* @param mixed $viewedAt
*/
public function setViewedAt($viewedAt): void
{
$this->viewedAt = $viewedAt;
}
/**
* @return int
*/
public function getOpened(): int
{
return $this->opened;
}
/**
* @param int $opened
*/
public function setOpened(int $opened): void
{
$this->opened = $opened;
}
/**
* @return mixed
*/
public function getOpenedAt()
{
return $this->openedAt;
}
/**
* @param mixed $openedAt
*/
public function setOpenedAt($openedAt): void
{
$this->openedAt = $openedAt;
}
/**
* @return int
*/
public function getVisible(): int
{
return $this->visible;
}
/**
* @param int $visible
*/
public function setVisible(int $visible): void
{
$this->visible = $visible;
}
/**
* @return int
*/
public function getEmailSent(): int
{
return $this->emailSent;
}
/**
* @param int $emailSent
*/
public function setEmailSent(int $emailSent): void
{
$this->emailSent = $emailSent;
}
}