src/Cms/FileBundle/Entity/BulkUpload.php line 23

Open in your IDE?
  1. <?php
  2. namespace Cms\FileBundle\Entity;
  3. use Cms\ContainerBundle\Entity\Container;
  4. use Cms\FileBundle\Entity\Nodes\Folder;
  5. use Cms\TenantBundle\Entity\TenantedEntity;
  6. use DateTime;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Platform\SecurityBundle\Entity\Identity\Account;
  9. /**
  10.  * Class BulkUpload
  11.  * @package Cms\FileBundle\Entity
  12.  *
  13.  * @ORM\Entity(
  14.  *     repositoryClass = "Cms\FileBundle\Doctrine\BulkUploadRepository"
  15.  * )
  16.  * @ORM\Table(
  17.  *     name = "cms__file__bulk_upload"
  18.  * )
  19.  */
  20. class BulkUpload extends TenantedEntity
  21. {
  22.     const STATUSES__ALLOCATED 0;
  23.     const STATUSES__PROCESSING 1;
  24.     const STATUSES__COMPLETE 2;
  25.     const STATUSES = array(
  26.         self::STATUSES__ALLOCATED,
  27.         self::STATUSES__PROCESSING,
  28.         self::STATUSES__COMPLETE,
  29.     );
  30.     /**
  31.      * @var Account
  32.      *
  33.      * @ORM\ManyToOne(
  34.      *     targetEntity = Account::class
  35.      * )
  36.      * @ORM\JoinColumn(
  37.      *     name = "account",
  38.      *     referencedColumnName = "id",
  39.      *     onDelete = "CASCADE"
  40.      * )
  41.      */
  42.     protected $account;
  43.     /**
  44.      * @var Container
  45.      *
  46.      * @ORM\ManyToOne(
  47.      *     targetEntity = Container::class
  48.      * )
  49.      * @ORM\JoinColumn(
  50.      *     name = "container",
  51.      *     referencedColumnName = "id",
  52.      *     onDelete = "CASCADE"
  53.      * )
  54.      */
  55.     protected $container;
  56.     /**
  57.      * @var Folder
  58.      *
  59.      * @ORM\ManyToOne(
  60.      *     targetEntity = Folder::class
  61.      * )
  62.      * @ORM\JoinColumn(
  63.      *     name = "folder",
  64.      *     referencedColumnName = "id",
  65.      *     onDelete = "CASCADE"
  66.      * )
  67.      */
  68.     protected $folder;
  69.     /**
  70.      * @var int
  71.      *
  72.      * @ORM\Column(
  73.      *     type = "integer",
  74.      *     nullable = false
  75.      * )
  76.      */
  77.     protected $status self::STATUSES__ALLOCATED;
  78.     /**
  79.      * @var string
  80.      *
  81.      * @ORM\Column(
  82.      *     type = "string",
  83.      *     nullable = true
  84.      * )
  85.      */
  86.     protected $username;
  87.     /**
  88.      * @var string
  89.      *
  90.      * @ORM\Column(
  91.      *     type = "text",
  92.      *     nullable = true
  93.      * )
  94.      */
  95.     protected $password;
  96.     /**
  97.      * @var DateTime
  98.      *
  99.      * @ORM\Column(
  100.      *     type = "datetime",
  101.      *     nullable = true
  102.      * )
  103.      */
  104.     protected $expiration;
  105.     /**
  106.      * @return Account
  107.      */
  108.     public function getAccount()
  109.     {
  110.         return $this->account;
  111.     }
  112.     /**
  113.      * @param Account $value
  114.      * @return $this
  115.      */
  116.     public function setAccount(Account $value)
  117.     {
  118.         $this->account $value;
  119.         return $this;
  120.     }
  121.     /**
  122.      * @return Container
  123.      */
  124.     public function getContainer()
  125.     {
  126.         return $this->container;
  127.     }
  128.     /**
  129.      * @param Container $value
  130.      * @return $this
  131.      */
  132.     public function setContainer(Container $value)
  133.     {
  134.         $this->container $value;
  135.         return $this;
  136.     }
  137.     /**
  138.      * @return Folder|null
  139.      */
  140.     public function getFolder()
  141.     {
  142.         return $this->folder;
  143.     }
  144.     /**
  145.      * @param Folder|null $value
  146.      * @return $this
  147.      */
  148.     public function setFolder(Folder $value null)
  149.     {
  150.         $this->folder $value;
  151.         return $this;
  152.     }
  153.     /**
  154.      * @return string
  155.      */
  156.     public function getUsername()
  157.     {
  158.         return $this->username;
  159.     }
  160.     /**
  161.      * @param string $value
  162.      * @return $this
  163.      */
  164.     public function setUsername($value)
  165.     {
  166.         $this->username $value;
  167.         return $this;
  168.     }
  169.     /**
  170.      * @return string
  171.      */
  172.     public function getPassword()
  173.     {
  174.         return $this->password;
  175.     }
  176.     /**
  177.      * @param string $value
  178.      * @return $this
  179.      */
  180.     public function setPassword($value)
  181.     {
  182.         $this->password $value;
  183.         return $this;
  184.     }
  185.     /**
  186.      * @return DateTime|null
  187.      */
  188.     public function getExpiration()
  189.     {
  190.         return $this->expiration;
  191.     }
  192.     /**
  193.      * @param DateTime|null $value
  194.      * @return $this
  195.      */
  196.     public function setExpiration(DateTime $value null)
  197.     {
  198.         $this->expiration $value;
  199.         return $this;
  200.     }
  201.     /**
  202.      * @return int
  203.      */
  204.     public function getStatus()
  205.     {
  206.         return $this->status;
  207.     }
  208.     /**
  209.      * @param int $value
  210.      * @return $this
  211.      * @throws \Exception
  212.      */
  213.     public function setStatus($value)
  214.     {
  215.         if ( ! in_array($valueself::STATUSES)) {
  216.             throw new \Exception();
  217.         }
  218.         $this->status $value;
  219.         return $this;
  220.     }
  221.     /**
  222.      * @param int $value
  223.      * @return bool
  224.      * @throws \Exception
  225.      */
  226.     public function isStatus($value)
  227.     {
  228.         if ( ! in_array($valueself::STATUSES)) {
  229.             throw new \Exception();
  230.         }
  231.         return ($this->status === $value);
  232.     }
  233. }