<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="App\Repository\LogRepository")
* @ORM\HasLifecycleCallbacks()
*/
class Log implements \Serializable
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="logs")
* @ORM\JoinColumn(nullable=false)
*/
private $user;
/**
* @ORM\Column(name="event", type="string")
*/
private $event;
/**
* @ORM\Column(name="entity", type="string", nullable=true)
*/
private $entity;
/**
* @ORM\Column(name="entity_id", type="string", nullable=true)
*/
private $entityId;
/**
* @ORM\Column(name="sources", type="json")
*/
private $sources;
/**
* @ORM\Column(name="created_at", type="datetime")
*/
private $createdAt;
/**
* @ORM\Column(name="updated_at", type="datetime",nullable=true)
*/
private $updatedAt;
/**
* @ORM\Column(name="counter", type="integer", options={"default": 1})
*/
private $counter=1;
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* @param mixed $id
*/
public function setId($id)
{
$this->id = $id;
}
/**
* @return mixed
*/
public function getUser()
{
return $this->user;
}
/**
* @param mixed $userId
*/
public function setUser($user)
{
$this->user = $user;
return $this;
}
/**
* @return mixed
*/
public function getEvent()
{
return $this->event;
}
/**
* @param mixed $event
*/
public function setEvent($event)
{
$this->event = $event;
return $this;
}
/**
* @return mixed
*/
public function getEntity()
{
return $this->entity;
}
/**
* @param mixed $entity
*/
public function setEntity($entity)
{
$this->entity = $entity;
return $this;
}
/**
* @return mixed
*/
public function getEntityId()
{
return $this->entityId;
}
/**
* @param mixed $entityId
*/
public function setEntityId($entityId)
{
$this->entityId = $entityId;
return $this;
}
/**
* @return mixed
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* @param mixed $createdAt
*/
public function setCreatedAt($createdAt)
{
$this->createdAt = $createdAt;
}
/**
* @ORM\PrePersist
*/
public function onPrePersist()
{
$this->createdAt = new \DateTime("now", new \DateTimeZone("Europe/Paris"));
$this->updatedAt = new \DateTime("now", new \DateTimeZone("Europe/Paris"));
}
/**
* @ORM\PreUpdate
*/
public function onPreUpdate()
{
$this->updatedAt = new \DateTime("now", new \DateTimeZone("Europe/Paris"));
}
/**
* @return mixed
*/
public function getSources()
{
return $this->sources;
}
/**
* @param mixed $sources
*/
public function setSources($sources): void
{
$this->sources = $sources;
}
/**
* String representation of object
* @link https://php.net/manual/en/serializable.serialize.php
* @return string the string representation of the object or null
* @since 5.1.0
*/
public function serialize()
{
// TODO: Implement serialize() method.
}
/**
* Constructs the object
* @link https://php.net/manual/en/serializable.unserialize.php
* @param string $serialized <p>
* The string representation of the object.
* </p>
* @return void
* @since 5.1.0
*/
public function unserialize($serialized)
{
// TODO: Implement unserialize() method.
}
/**
* @return mixed
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}
/**
* @param mixed $updatedAt
*/
public function setUpdatedAt($updatedAt): void
{
$this->updatedAt = $updatedAt;
}
/**
* @return int
*/
public function getCounter(): int
{
return $this->counter;
}
/**
* @param int $counter
*/
public function setCounter(int $counter): void
{
$this->counter = $counter;
}
}