<?php
namespace App\Entity;
use Symfony\Component\Validator\Constraints as Assert;
use App\Api\SalesforceRest\Controllers\Custom\AccountController;
class Account
{
/**
* @Assert\NotBlank
* @Assert\Length(
* min=10,
* max=10,
* minMessage = "{{ limit }} caractères minimum",
* maxMessage = "{{ limit }} caractères maximum",
* exactMessage = "Le code est erroné",
* allowEmptyString = false
* )
* @var string
*/
protected $accessCode;
/**
* @var string
*/
protected $ce;
// /**
// * Account constructor.
// * @param string $accessCode
// */
// public function __construct(string $accessCode){
// $this->accessCode = $accessCode;
// }
/**
* Checks if the connexion is ok
* @return bool
*/
public function isEligible() : bool
{
return $this->ce !== '';
}
/**
* Get the CE from Salesforce with the access code
*/
public function getCEByCode() : void
{
$this->ce = AccountController::getCeByAccessCode($this->accessCode);
}
/**
* @return mixed
*/
public function getAccessCode()
{
return $this->accessCode;
}
/**
* @param mixed $accessCode
* @return Account
*/
public function setAccessCode($accessCode)
{
$this->accessCode = $accessCode;
return $this;
}
/**
* @return string
*/
public function getCe()
{
return $this->ce;
}
/**
* @param string $ce
* @return Account
*/
public function setCe(string $ce)
{
$this->ce = $ce;
return $this;
}
}