src/Services/ConfigurationBundle/Entity/PspLogs.php line 365

Open in your IDE?
  1. <?php
  2. namespace Services\ConfigurationBundle\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use JsonSerializable;
  5. use Services\PaymentBundle\Entity\PaymentTypes;
  6. /**
  7.  * PSP Log. Table where every call to a PSP is logged.
  8.  *
  9.  * @ORM\Table(name="log_psp", indexes={@ORM\Index(name="siteNameConfig", columns={"site"}), @ORM\Index(name="user_email", columns={"email"})})
  10.  * @ORM\Entity(repositoryClass="Services\ConfigurationBundle\Repository\PspLogsRepository")
  11.  */
  12. class PspLogs implements JsonSerializable
  13. {
  14.     /**
  15.      * @var int
  16.      *
  17.      * @ORM\Column(name="id", type="integer", options={"unsigned"=true})
  18.      * @ORM\Id
  19.      * @ORM\GeneratedValue(strategy="AUTO")
  20.      */
  21.     private $id;
  22.     /**
  23.      * @var string
  24.      *
  25.      * @ORM\Column(name="site", type="string", length=80, nullable=true)
  26.      */
  27.     private $site;
  28.     /**
  29.      * @var string
  30.      *
  31.      * @ORM\Column(name="psp_name", type="string")
  32.      */
  33.     private $pspName;
  34.     /**
  35.      * @var string
  36.      *
  37.      * @ORM\Column(name="email", type="string", nullable=true)
  38.      */
  39.     private $email;
  40.     /**
  41.      * @var string
  42.      *
  43.      * @ORM\Column(name="request_url", type="text")
  44.      */
  45.     private $requestUrl;
  46.     /**
  47.      * @var string
  48.      *
  49.      * @ORM\Column(name="request", type="text")
  50.      */
  51.     private $request;
  52.     /**
  53.      * @var string
  54.      *
  55.      * @ORM\Column(name="response", type="text", nullable=true)
  56.      */
  57.     private $response;
  58.     /**
  59.      * @var string
  60.      *
  61.      * @ORM\Column(name="method", type="string", nullable=true)
  62.      */
  63.     private $method;
  64.     /**
  65.      * @var \DateTime
  66.      *
  67.      * @ORM\Column(name="created_at", type="datetime", options={"default":"CURRENT_TIMESTAMP"})
  68.      */
  69.     private $createdAt;
  70.     /**
  71.      * @var int
  72.      *
  73.      * @ORM\Column(name="paymentTypes_id", type="integer", nullable=true)
  74.      */
  75.     private $paymentTypesId;
  76.     /**
  77.      * Summary of __construct
  78.      * @param string $site
  79.      * @param PaymentTypes $psp
  80.      * @param string $email
  81.      * @param string|null $requestUrl
  82.      * @param string|null $request
  83.      * @param string $response
  84.      * @param string $method
  85.      */
  86.     public function __construct(
  87.         ?string $site '',
  88.         PaymentTypes $psp null,
  89.         string $email '',
  90.         ?string $requestUrl '',
  91.         ?string $request '',
  92.         string $response '',
  93.         string $method 'POST'
  94.     ) {
  95.         $this->site $site;
  96.         $this->pspName $psp $psp->getNameConfig() : '';
  97.         $this->email $email;
  98.         $this->requestUrl $requestUrl ?? '';
  99.         $this->request $request ?? '';
  100.         $this->response $response;
  101.         $this->method $method;
  102.         $this->createdAt = new \DateTime('now');
  103.         $this->paymentTypesId $psp $psp->getId() : null;
  104.     }
  105.     /**
  106.      * Get the value of id
  107.      *
  108.      * @return  int
  109.      */
  110.     public function getId()
  111.     {
  112.         return $this->id;
  113.     }
  114.     /**
  115.      * Set the value of id
  116.      *
  117.      * @param  integer  $id
  118.      *
  119.      * @return  self
  120.      */ 
  121.     public function setId($id)
  122.     {
  123.         $this->id $id;
  124.         return $this;
  125.     }
  126.     /**
  127.      * Get the value of site
  128.      *
  129.      * @return  string
  130.      */ 
  131.     public function getSite()
  132.     {
  133.         return $this->site;
  134.     }
  135.     /**
  136.      * Set the value of site
  137.      *
  138.      * @param  string  $site
  139.      *
  140.      * @return  self
  141.      */ 
  142.     public function setSite(string $site)
  143.     {
  144.         $this->site $site;
  145.         return $this;
  146.     }
  147.     /**
  148.      * Get the value of pspName
  149.      *
  150.      * @return  string
  151.      */
  152.     public function getPspName()
  153.     {
  154.         return $this->pspName;
  155.     }
  156.     /**
  157.      * Set the value of pspName
  158.      *
  159.      * @param  string  $pspName
  160.      *
  161.      * @return  self
  162.      */
  163.     public function setPspName(string $pspName)
  164.     {
  165.         $this->pspName $pspName;
  166.         return $this;
  167.     }
  168.     /**
  169.      * Get the value of email
  170.      *
  171.      * @return  string
  172.      */ 
  173.     public function getEmail()
  174.     {
  175.         return $this->email;
  176.     }
  177.     /**
  178.      * Set the value of email
  179.      *
  180.      * @param  string  $email
  181.      *
  182.      * @return  self
  183.      */ 
  184.     public function setEmail(string $email)
  185.     {
  186.         $this->email $email;
  187.         return $this;
  188.     }
  189.     /**
  190.      * Get the value of requestUrl
  191.      *
  192.      * @return  string
  193.      */
  194.     public function getRequestUrl()
  195.     {
  196.         return $this->requestUrl;
  197.     }
  198.     /**
  199.      * Set the value of requestUrl
  200.      *
  201.      * @param  string  $requestUrl
  202.      *
  203.      * @return  self
  204.      */
  205.     public function setRequestUrl(string $requestUrl)
  206.     {
  207.         $this->requestUrl $requestUrl;
  208.         return $this;
  209.     }
  210.     /**
  211.      * Get the value of request
  212.      *
  213.      * @return  string
  214.      */
  215.     public function getRequest()
  216.     {
  217.         return $this->request;
  218.     }
  219.     /**
  220.      * Set the value of request
  221.      *
  222.      * @param  string  $request
  223.      *
  224.      * @return  self
  225.      */
  226.     public function setRequest(string $request)
  227.     {
  228.         $this->request $request;
  229.         return $this;
  230.     }
  231.     /**
  232.      * Get the value of response
  233.      *
  234.      * @return  string
  235.      */
  236.     public function getResponse()
  237.     {
  238.         return $this->response;
  239.     }
  240.     /**
  241.      * Set the value of response
  242.      *
  243.      * @param  string  $response
  244.      *
  245.      * @return  self
  246.      */
  247.     public function setResponse(string $response)
  248.     {
  249.         $this->response $response;
  250.         return $this;
  251.     }
  252.     /**
  253.      * Get the value of method
  254.      *
  255.      * @return  string
  256.      */
  257.     public function getMethod()
  258.     {
  259.         return $this->method;
  260.     }
  261.     /**
  262.      * Set the value of method
  263.      *
  264.      * @param  string  $method
  265.      *
  266.      * @return  self
  267.      */
  268.     public function setMethod(string $method)
  269.     {
  270.         $this->method $method;
  271.         return $this;
  272.     }
  273.     /**
  274.      * Get the value of createdAt
  275.      *
  276.      * @return  \DateTime
  277.      */
  278.     public function getCreatedAt()
  279.     {
  280.         return $this->createdAt;
  281.     }
  282.     /**
  283.      * Set the value of createdAt
  284.      *
  285.      * @param  \DateTime  $createdAt
  286.      *
  287.      * @return  self
  288.      */
  289.     public function setCreatedAt(\DateTime $createdAt)
  290.     {
  291.         $this->createdAt $createdAt;
  292.         return $this;
  293.     }
  294.     /**
  295.      * Get the value of paymentTypesId
  296.      *
  297.      * @return  int
  298.      */
  299.     public function getPaymentTypesId(): int
  300.     {
  301.         return $this->paymentTypesId;
  302.     }
  303.     /**
  304.      * Set the value of paymentTypesId
  305.      *
  306.      * @param  integer  $id
  307.      *
  308.      * @return  self
  309.      */
  310.     public function setPaymentTypesId(int $id): self
  311.     {
  312.         $this->paymentTypesId $id;
  313.         return $this;
  314.     }
  315.     /**
  316.      * Specify data which should be serialized to JSON
  317.      * @return array
  318.      */
  319.     public function jsonSerialize()
  320.     {
  321.         return [
  322.             $this->createdAt,
  323.             $this->site,
  324.             $this->pspName,
  325.             $this->email,
  326.             $this->requestUrl,
  327.             $this->request json_decode($this->request) : '',
  328.             $this->response json_decode($this->response) : '',
  329.             $this->method,
  330.             $this->paymentTypesId
  331.         ];
  332.     }
  333. }