<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\User\UserInterface;
/**
* @ORM\Entity(repositoryClass="App\Repository\ConnectionRepository")
*/
class Connection implements UserInterface
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private ?int $id;
/**
* @ORM\Column(name="client_id", type="string", length=255, nullable=true)
*/
private ?string $clientId;
/**
* @ORM\Column(name="api_url", type="string", length=255, nullable=true)
*/
private ?string $apiUrl;
/**
* @ORM\Column(name="api_key", type="string", length=255, nullable=true)
*/
private ?string $apiKey;
/**
* @ORM\OneToOne (
* targetEntity="App\Entity\AccountSettings",
* mappedBy="connection",
* orphanRemoval=true,
* cascade={"remove"}
* )
*/
private ?AccountSettings $accountSettings;
/**
* @return int|null
*/
public function getId(): ?int
{
return $this->id;
}
/**
* @return string|null
*/
public function getClientId(): ?string
{
return $this->clientId;
}
/**
* @param string|null $clientId
*
* @return Connection
*/
public function setClientId(?string $clientId): self
{
$this->clientId = $clientId;
return $this;
}
/**
* @return string|null
*/
public function getApiUrl(): ?string
{
return $this->apiUrl;
}
/**
* @param string|null $apiUrl
*
* @return Connection
*/
public function setApiUrl(?string $apiUrl): self
{
$this->apiUrl = $apiUrl;
return $this;
}
/**
* @return string|null
*/
public function getApiKey(): ?string
{
return $this->apiKey;
}
/**
* @param string|null $apiKey
*
* @return Connection
*/
public function setApiKey(?string $apiKey): self
{
$this->apiKey = $apiKey;
return $this;
}
/**
* Returns the user id used to authenticate the user.
*
* @return string clientId
*/
public function getUsername()
{
return $this->clientId;
}
/**
* @return string|null
*/
public function getCrmUrl(): ?string
{
return $this->apiUrl;
}
/**
* @param string|null $apiUrl
*
* @return Connection
*/
public function setCrmUrl(?string $apiUrl): self
{
return $this->setApiUrl($apiUrl);
}
/**
* @return AccountSettings|null
*/
public function getAccountSettings(): ?AccountSettings
{
return $this->accountSettings;
}
/**
* @param AccountSettings|null $accountSettings
*/
public function setAccountSettings(?AccountSettings $accountSettings): void
{
$this->accountSettings = $accountSettings;
}
/**
* The public representation of the user (e.g. a username, an email address, etc.)
*
* @see UserInterface
*/
public function getUserIdentifier(): string
{
return (string) $this->clientId;
}
/**
* @see UserInterface
*/
public function getRoles(): array
{
return ['ROLE_USER'];
}
/**
* Returns the password used to authenticate the user.
*
* This should be the encoded password. On authentication, a plain-text
* password will be salted, encoded, and then compared to this value.
*
* @return string|null The encoded password if any
*/
public function getPassword(): ?string
{
return hash('ripemd160', (string)time());
}
/**
* Returning a salt is only needed, if you are not using a modern
* hashing algorithm (e.g. bcrypt or sodium) in your security.yaml.
*
* @see UserInterface
*/
public function getSalt(): ?string
{
return null;
}
/**
* @see UserInterface
*/
public function eraseCredentials(): void
{
// If you store any temporary, sensitive data on the user, clear it here
// $this->plainPassword = null;
}
}