<?phpnamespace App\Entity;use Symfony\Component\Security\Core\User\UserInterface;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity * @ORM\Table(name="malys_api_client") * @ORM\HasLifecycleCallbacks() */class ApiClient implements UserInterface { /** * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", unique=true) */ private $name; /** * @ORM\Column(type="string", unique=true) */ private $username; /** * @ORM\Column(type="string", unique=true) */ private $apiKey; /** * @var boolean * * @ORM\Column(name="enabled", type="boolean" ) */ protected $enabled = true; public function getUsername() { return $this->username; } public function getRoles() { return array( 'ROLE_API_CLIENT' ); } public function getPassword() { return null; } public function getSalt() { return null; } public function eraseCredentials() { } /** * @var \DateTime * * @ORM\Column(name="createdAt", type="datetime", nullable=false) */ protected $createdAt; /** * @var \DateTime * * @ORM\Column(name="updatedAt", type="datetime", nullable=true) */ protected $updatedAt; /** * Set createdAt * * @return $this * @ORM\PrePersist */ public function setCreatedAt() { $this->createdAt = new \DateTime(); $this->updatedAt = new \DateTime(); return $this; } /** * @return \DateTime */ public function getUpdatedAt() { return $this->updatedAt; } /** * Set updatedAt * * @return $this * @ORM\PreUpdate */ public function setUpdatedAt() { $this->updatedAt = new \DateTime(); return $this; } /** * @return mixed */ public function getApiKey() { return $this->apiKey; } /** * @param mixed $apiKey */ public function setApiKey( $apiKey ) { $this->apiKey = $apiKey; $this->username = $apiKey; } /** * @return bool */ public function isEnabled() { return $this->enabled; } /** * @param bool $enabled */ public function setEnabled( $enabled ) { $this->enabled = $enabled; } /** * @return mixed */ public function getName() { return $this->name; } /** * @param mixed $name */ public function setName( $name ) { $this->name = $name; } /** * @return mixed */ public function getId() { return $this->id; } /** * @param mixed $id */ public function setId( $id ) { $this->id = $id; }}?>