src/Entity/Card.php line 39

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the kProjet project.
  4.  *
  5.  * (c) Kodiom <info@kodiom.com>
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10.  namespace App\Entity;
  11.  use Doctrine\ORM\Mapping as ORM;
  12.  use Symfony\Component\Validator\Constraints as Assert;
  13.  use App\Entity\Client;
  14.  use ApiPlatform\Core\Annotation\ApiResource;
  15.  use Symfony\Component\Serializer\Annotation\Groups;
  16.  use App\Repository\CardRepository;
  17.     /**
  18.      * Card
  19.     *
  20.     * @ORM\Table()
  21.     * @ORM\Entity(repositoryClass=CardRepository::class)
  22.     *
  23.     * @ApiResource(
  24.     *     attributes={
  25.     *       "filters"={"card.search"},
  26.     *       "force_eager"=false,
  27.     *       "normalization_context"={"groups"={"read", "user", "media", "client"}},
  28.     *       "denormalization_context"={"groups"={"read", "user", "media"}}
  29.     *     },
  30.     *     collectionOperations={
  31.     *        "get"={"method"="GET"},
  32.     *        "post"={"route_name"="api_cards_post_collection"}
  33.     *     }
  34.     * )
  35.     */
  36. class Card
  37. {
  38.     /**
  39.      * @var int
  40.      *
  41.      * @ORM\Column(name="id", type="integer")
  42.      * @ORM\Id
  43.      * @ORM\GeneratedValue(strategy="AUTO")
  44.      *
  45.      * @Groups({"read"})
  46.      */
  47.     private $id;
  48.     /**
  49.      * Payment intend ID => TODO: payment id
  50.      * @var string
  51.      *
  52.      * @ORM\Column(type="string", length=200, nullable=true)
  53.      * @Groups({"read"})
  54.      */
  55.     private $token;
  56.     /**
  57.      *
  58.      * Payment method ID => TODO: rename field
  59.      * @var string
  60.      *
  61.      * @ORM\Column(type="string", length=200, nullable=true)
  62.      * @Groups({"read"})
  63.      */
  64.     private $cardToken;
  65.     /**
  66.      * Customer Stripe ID => TODO: Rename field..
  67.      *
  68.      * @ORM\Column(type="string", length=200, nullable=true)
  69.      * @Groups({"read"})
  70.      */
  71.     private $customerToken;
  72.     /**
  73.      * @var string
  74.      *
  75.      * @ORM\Column(type="string", length=10, nullable=true)
  76.      *
  77.      * @Assert\NotBlank()
  78.      * @Groups({"read"})
  79.      */
  80.     private $lastDigit;
  81.     /**
  82.      * @var sca
  83.      * Répresnete le novueau format des cartes
  84.      * @ORM\Column(type="boolean")
  85.      *
  86.      * @Groups({"read"})
  87.      */
  88.     private $sca 1;
  89.     /**
  90.      * @var Client
  91.      *
  92.      * @ORM\ManyToOne(
  93.      *   targetEntity=Client::class
  94.      * )
  95.      * @Groups({"read"})
  96.      */
  97.     private $client;
  98.     public function __toString()
  99.     {
  100.         return ($this->getToken()) ? $this->getToken() : '';
  101.     }
  102.     /**
  103.      * Get id
  104.      *
  105.      * @return integer
  106.      */
  107.     public function getId()
  108.     {
  109.         return $this->id;
  110.     }
  111.     /**
  112.      * Get token
  113.      *
  114.      * @return string
  115.      */
  116.     public function getToken()
  117.     {
  118.         return $this->token;
  119.     }
  120.     /**
  121.      * Set token
  122.      *
  123.      * @param string $token
  124.      *
  125.      * @return Card
  126.      */
  127.     public function setToken($token)
  128.     {
  129.         $this->token $token;
  130.         return $this;
  131.     }
  132.     /**
  133.      * Get cardToken
  134.      *
  135.      * @return string
  136.      */
  137.     public function getCardToken()
  138.     {
  139.         return $this->cardToken;
  140.     }
  141.     /**
  142.      * Set cardToken
  143.      *
  144.      * @param string $cardToken
  145.      *
  146.      * @return Card
  147.      */
  148.     public function setCardToken($cardToken)
  149.     {
  150.         $this->cardToken $cardToken;
  151.         return $this;
  152.     }
  153.     /**
  154.      * Get customerToken
  155.      *
  156.      * @return string
  157.      */
  158.     public function getCustomerToken()
  159.     {
  160.         return $this->customerToken;
  161.     }
  162.     /**
  163.      * Set customerToken
  164.      *
  165.      * @param string $customerToken
  166.      *
  167.      * @return Card
  168.      */
  169.     public function setCustomerToken($customerToken)
  170.     {
  171.         $this->customerToken $customerToken;
  172.         return $this;
  173.     }
  174.     /**
  175.      * Get lastDigit
  176.      *
  177.      * @return string
  178.      */
  179.     public function getLastDigit()
  180.     {
  181.         return $this->lastDigit;
  182.     }
  183.     /**
  184.      * Set lastDigit
  185.      *
  186.      * @param string $lastDigit
  187.      *
  188.      * @return Card
  189.      */
  190.     public function setLastDigit($lastDigit)
  191.     {
  192.         $this->lastDigit $lastDigit;
  193.         return $this;
  194.     }
  195.     /**
  196.      * Get client
  197.      *
  198.      * @return Client
  199.      */
  200.     public function getClient()
  201.     {
  202.         return $this->client;
  203.     }
  204.     /**
  205.      * Set client
  206.      *
  207.      * @param Client $client
  208.      *
  209.      * @return Card
  210.      */
  211.     public function setClient(?Client $client)
  212.     {
  213.         $this->client $client;
  214.         return $this;
  215.     }
  216.     /**
  217.      * @return sca
  218.      */
  219.     public function getSca()
  220.     {
  221.         return $this->sca;
  222.     }
  223.     /**
  224.      * @param sca $sca
  225.      */
  226.     public function setSca($sca)
  227.     {
  228.         $this->sca $sca;
  229.     }
  230. }