src/Entity/Log.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. /**
  5.  * @ORM\Entity(repositoryClass="App\Repository\LogRepository")
  6.  * @ORM\HasLifecycleCallbacks()
  7.  */
  8. class Log implements \Serializable
  9. {
  10.     /**
  11.      * @ORM\Id
  12.      * @ORM\GeneratedValue
  13.      * @ORM\Column(type="integer")
  14.      */
  15.     private $id;
  16.     /**
  17.      * @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="logs")
  18.      * @ORM\JoinColumn(nullable=false)
  19.      */
  20.     private $user;
  21.     /**
  22.      * @ORM\Column(name="event", type="string")
  23.      */
  24.     private $event;
  25.     /**
  26.      * @ORM\Column(name="entity", type="string", nullable=true)
  27.      */
  28.     private $entity;
  29.     /**
  30.      * @ORM\Column(name="entity_id", type="string", nullable=true)
  31.      */
  32.     private $entityId;
  33.     /**
  34.      * @ORM\Column(name="sources", type="json")
  35.      */
  36.     private $sources;
  37.     /**
  38.      * @ORM\Column(name="created_at", type="datetime")
  39.      */
  40.     private $createdAt;
  41.     /**
  42.      * @ORM\Column(name="updated_at", type="datetime",nullable=true)
  43.      */
  44.     private $updatedAt;
  45.     /**
  46.      * @ORM\Column(name="counter", type="integer", options={"default": 1})
  47.      */
  48.     private $counter=1;
  49.     /**
  50.      * @return mixed
  51.      */
  52.     public function getId()
  53.     {
  54.         return $this->id;
  55.     }
  56.     /**
  57.      * @param mixed $id
  58.      */
  59.     public function setId($id)
  60.     {
  61.         $this->id $id;
  62.     }
  63.     /**
  64.      * @return mixed
  65.      */
  66.     public function getUser()
  67.     {
  68.         return $this->user;
  69.     }
  70.     /**
  71.      * @param mixed $userId
  72.      */
  73.     public function setUser($user)
  74.     {
  75.         $this->user $user;
  76.         return $this;
  77.     }
  78.     /**
  79.      * @return mixed
  80.      */
  81.     public function getEvent()
  82.     {
  83.         return $this->event;
  84.     }
  85.     /**
  86.      * @param mixed $event
  87.      */
  88.     public function setEvent($event)
  89.     {
  90.         $this->event $event;
  91.         return $this;
  92.     }
  93.     /**
  94.      * @return mixed
  95.      */
  96.     public function getEntity()
  97.     {
  98.         return $this->entity;
  99.     }
  100.     /**
  101.      * @param mixed $entity
  102.      */
  103.     public function setEntity($entity)
  104.     {
  105.         $this->entity $entity;
  106.         return $this;
  107.     }
  108.     /**
  109.      * @return mixed
  110.      */
  111.     public function getEntityId()
  112.     {
  113.         return $this->entityId;
  114.     }
  115.     /**
  116.      * @param mixed $entityId
  117.      */
  118.     public function setEntityId($entityId)
  119.     {
  120.         $this->entityId $entityId;
  121.         return $this;
  122.     }
  123.     /**
  124.      * @return mixed
  125.      */
  126.     public function getCreatedAt()
  127.     {
  128.         return $this->createdAt;
  129.     }
  130.     /**
  131.      * @param mixed $createdAt
  132.      */
  133.     public function setCreatedAt($createdAt)
  134.     {
  135.         $this->createdAt $createdAt;
  136.     }
  137.     /**
  138.      * @ORM\PrePersist
  139.      */
  140.     public function onPrePersist()
  141.     {
  142.         $this->createdAt = new \DateTime("now", new \DateTimeZone("Europe/Paris"));
  143.         $this->updatedAt = new \DateTime("now", new \DateTimeZone("Europe/Paris"));
  144.     }
  145.     /**
  146.      * @ORM\PreUpdate
  147.      */
  148.     public function onPreUpdate()
  149.     {
  150.         $this->updatedAt = new \DateTime("now", new \DateTimeZone("Europe/Paris"));
  151.     }
  152.     /**
  153.      * @return mixed
  154.      */
  155.     public function getSources()
  156.     {
  157.         return $this->sources;
  158.     }
  159.     /**
  160.      * @param mixed $sources
  161.      */
  162.     public function setSources($sources): void
  163.     {
  164.         $this->sources $sources;
  165.     }
  166.     /**
  167.      * String representation of object
  168.      * @link https://php.net/manual/en/serializable.serialize.php
  169.      * @return string the string representation of the object or null
  170.      * @since 5.1.0
  171.      */
  172.     public function serialize()
  173.     {
  174.         // TODO: Implement serialize() method.
  175.     }
  176.     /**
  177.      * Constructs the object
  178.      * @link https://php.net/manual/en/serializable.unserialize.php
  179.      * @param string $serialized <p>
  180.      * The string representation of the object.
  181.      * </p>
  182.      * @return void
  183.      * @since 5.1.0
  184.      */
  185.     public function unserialize($serialized)
  186.     {
  187.         // TODO: Implement unserialize() method.
  188.     }
  189.     /**
  190.      * @return mixed
  191.      */
  192.     public function getUpdatedAt()
  193.     {
  194.         return $this->updatedAt;
  195.     }
  196.     /**
  197.      * @param mixed $updatedAt
  198.      */
  199.     public function setUpdatedAt($updatedAt): void
  200.     {
  201.         $this->updatedAt $updatedAt;
  202.     }
  203.     /**
  204.      * @return int
  205.      */
  206.     public function getCounter(): int
  207.     {
  208.         return $this->counter;
  209.     }
  210.     /**
  211.      * @param int $counter
  212.      */
  213.     public function setCounter(int $counter): void
  214.     {
  215.         $this->counter $counter;
  216.     }
  217. }