src/Cms/ImportBundle/Entity/Import.php line 24

Open in your IDE?
  1. <?php
  2. namespace Cms\ImportBundle\Entity;
  3. use Cms\TenantBundle\Entity\TenantedEntity;
  4. use DateTimeInterface;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7.  * An Import within the system of data of a certain type.
  8.  * Controls the basic functioning of an import.
  9.  * Most data concerning actual import actions are held within the ImportState entity.
  10.  *
  11.  * Class Import
  12.  * @package Cms\ImportBundle\Entity
  13.  *
  14.  * @ORM\Entity(
  15.  *     repositoryClass = "Cms\ImportBundle\Doctrine\ImportRepository"
  16.  * )
  17.  * @ORM\Table(
  18.  *     name = "cms__import__import"
  19.  * )
  20.  */
  21. class Import extends TenantedEntity
  22. {
  23.     /**
  24.      * The name of the import for quick reference.
  25.      *
  26.      * @var string
  27.      *
  28.      * @ORM\Column(
  29.      *     type = "string",
  30.      *     nullable = false,
  31.      * )
  32.      */
  33.     protected $name;
  34.     /**
  35.      * A more detailed description of what the import is for.
  36.      *
  37.      * @var string|null
  38.      *
  39.      * @ORM\Column(
  40.      *     type = "text",
  41.      *     nullable = true,
  42.      * )
  43.      */
  44.     protected $description null;
  45.     /**
  46.      * The type of data covered with the import.
  47.      *
  48.      * @var string
  49.      *
  50.      * @ORM\Column(
  51.      *     type = "string",
  52.      *     nullable = false,
  53.      * )
  54.      */
  55.     protected $type;
  56.     /**
  57.      * @deprecated
  58.      *
  59.      * @var array
  60.      *
  61.      * @ORM\Column(
  62.      *     type = "json",
  63.      *     nullable = false,
  64.      * )
  65.      */
  66.     protected $mappings = [];
  67.     /**
  68.      * @deprecated
  69.      *
  70.      * @var DateTimeInterface|null
  71.      *
  72.      * @ORM\Column(
  73.      *     type = "datetime",
  74.      *     nullable = true,
  75.      * )
  76.      */
  77.     protected $processedAt null;
  78.     /**
  79.      * @deprecated
  80.      *
  81.      * @var DateTimeInterface|null
  82.      *
  83.      * @ORM\Column(
  84.      *     type = "datetime",
  85.      *     nullable = true,
  86.      * )
  87.      */
  88.     protected $uploadedAt null;
  89.     /**
  90.      * @deprecated
  91.      *
  92.      * @var string|null
  93.      *
  94.      * @ORM\Column(
  95.      *     type = "string",
  96.      *     nullable = true,
  97.      * )
  98.      */
  99.     protected $uploadedType null;
  100.     /**
  101.      * @deprecated
  102.      *
  103.      * @var string|null
  104.      *
  105.      * @ORM\Column(
  106.      *     type = "string",
  107.      *     nullable = true,
  108.      * )
  109.      */
  110.     protected $uploadedFilename null;
  111.     /**
  112.      * @deprecated
  113.      *
  114.      * @var int
  115.      *
  116.      * @ORM\Column(
  117.      *     type = "integer",
  118.      *     nullable = true,
  119.      * )
  120.      */
  121.     protected $processingTime 0;
  122.     /**
  123.      * @deprecated
  124.      *
  125.      * @var array
  126.      *
  127.      * @ORM\Column(
  128.      *     type = "array",
  129.      *     nullable = true,
  130.      * )
  131.      */
  132.     protected $columns = [];
  133.     /**
  134.      * Whether or not the import data should be "indexed", meaning a hidden identifier is used in order to perform future updates/merges on the import data.
  135.      *
  136.      * @var bool
  137.      *
  138.      * @ORM\Column(
  139.      *     type = "boolean",
  140.      *     nullable = false,
  141.      *     options = {
  142.      *         "default" = false,
  143.      *     },
  144.      * )
  145.      */
  146.     protected $indexed false;
  147.     /**
  148.      * @var ImportState
  149.      *
  150.      * @ORM\OneToOne(
  151.      *     targetEntity = ImportState::class,
  152.      * )
  153.      * @ORM\JoinColumn(
  154.      *     name = "currentState",
  155.      *     referencedColumnName = "id",
  156.      *     onDelete = "SET NULL",
  157.      *     nullable = true,
  158.      * )
  159.      */
  160.     protected $currentState null;
  161.     /**
  162.      * @var ImportState
  163.      *
  164.      * @ORM\OneToOne(
  165.      *     targetEntity = ImportState::class,
  166.      * )
  167.      * @ORM\JoinColumn(
  168.      *     name = "liveState",
  169.      *     referencedColumnName = "id",
  170.      *     onDelete = "SET NULL",
  171.      *     nullable = true,
  172.      * )
  173.      */
  174.     protected $liveState null;
  175.     /**
  176.      * @deprecated
  177.      *
  178.      * @return bool
  179.      */
  180.     public function isMapped(): bool
  181.     {
  182.         return ( ! empty($this->getMappings()));
  183.     }
  184.     /**
  185.      * @deprecated
  186.      *
  187.      * @return bool
  188.      */
  189.     public function isUploaded(): bool
  190.     {
  191.         return ($this->getUploadedAt() instanceof DateTimeInterface);
  192.     }
  193.     /**
  194.      * @deprecated
  195.      *
  196.      * @return bool
  197.      */
  198.     public function isProcessed(): bool
  199.     {
  200.         return ($this->getProcessedAt() instanceof DateTimeInterface);
  201.     }
  202.     /**
  203.      * @return bool
  204.      */
  205.     public function isIndexed(): bool
  206.     {
  207.         return ($this->indexed === true);
  208.     }
  209.     /**
  210.      * @param bool $indexed
  211.      * @return $this
  212.      */
  213.     public function setIndexed(bool $indexed): self
  214.     {
  215.         $this->indexed = ($indexed === true);
  216.         return $this;
  217.     }
  218.     /**
  219.      * @deprecated
  220.      *
  221.      * @return int
  222.      */
  223.     public function getProcessingTime(): int
  224.     {
  225.         return $this->processingTime ?? 0;
  226.     }
  227.     /**
  228.      * @deprecated
  229.      *
  230.      * @param int $processingTime
  231.      * @return $this
  232.      */
  233.     public function setProcessingTime(int $processingTime): self
  234.     {
  235.         $this->processingTime $processingTime;
  236.         return $this;
  237.     }
  238.     /**
  239.      * @return string|null
  240.      */
  241.     public function getName(): ?string
  242.     {
  243.         return $this->name;
  244.     }
  245.     /**
  246.      * @param string $name
  247.      * @return $this
  248.      */
  249.     public function setName(string $name): self
  250.     {
  251.         $this->name $name;
  252.         return $this;
  253.     }
  254.     /**
  255.      * @return string|null
  256.      */
  257.     public function getDescription(): ?string
  258.     {
  259.         return $this->description;
  260.     }
  261.     /**
  262.      * @param string|null $description
  263.      * @return $this
  264.      */
  265.     public function setDescription(?string $description): self
  266.     {
  267.         $this->description $description;
  268.         return $this;
  269.     }
  270.     /**
  271.      * @return string
  272.      */
  273.     public function getType(): string
  274.     {
  275.         return $this->type;
  276.     }
  277.     /**
  278.      * @param string $type
  279.      * @return $this
  280.      */
  281.     public function setType(string $type): self
  282.     {
  283.         $this->type $type;
  284.         return $this;
  285.     }
  286.     /**
  287.      * @deprecated
  288.      *
  289.      * @return array
  290.      */
  291.     public function getMappings(): array
  292.     {
  293.         return $this->mappings;
  294.     }
  295.     /**
  296.      * @deprecated
  297.      *
  298.      * @param array $mappings
  299.      * @return $this
  300.      */
  301.     public function setMappings(array $mappings): self
  302.     {
  303.         $this->mappings $mappings;
  304.         return $this;
  305.     }
  306.     /**
  307.      * @deprecated
  308.      *
  309.      * @return DateTimeInterface|null
  310.      */
  311.     public function getProcessedAt(): ?DateTimeInterface
  312.     {
  313.         return $this->processedAt;
  314.     }
  315.     /**
  316.      * @deprecated
  317.      *
  318.      * @param DateTimeInterface|null $processedAt
  319.      * @return $this
  320.      */
  321.     public function setProcessedAt(?DateTimeInterface $processedAt): self
  322.     {
  323.         $this->processedAt $processedAt;
  324.         return $this;
  325.     }
  326.     /**
  327.      * @deprecated
  328.      *
  329.      * @return DateTimeInterface|null
  330.      */
  331.     public function getUploadedAt(): ?DateTimeInterface
  332.     {
  333.         return $this->uploadedAt;
  334.     }
  335.     /**
  336.      * @deprecated
  337.      *
  338.      * @param DateTimeInterface|null $uploadedAt
  339.      * @return $this
  340.      */
  341.     public function setUploadedAt(?DateTimeInterface $uploadedAt): self
  342.     {
  343.         $this->uploadedAt $uploadedAt;
  344.         return $this;
  345.     }
  346.     /**
  347.      * @deprecated
  348.      *
  349.      * @return string|null
  350.      */
  351.     public function getUploadedType(): ?string
  352.     {
  353.         return $this->uploadedType;
  354.     }
  355.     /**
  356.      * @deprecated
  357.      *
  358.      * @param string|null $uploadedType
  359.      * @return $this
  360.      */
  361.     public function setUploadedType(?string $uploadedType): self
  362.     {
  363.         $this->uploadedType $uploadedType;
  364.         return $this;
  365.     }
  366.     /**
  367.      * @deprecated
  368.      *
  369.      * @return string|null
  370.      */
  371.     public function getUploadedFilename(): ?string
  372.     {
  373.         return $this->uploadedFilename;
  374.     }
  375.     /**
  376.      * @deprecated
  377.      *
  378.      * @param string|null $uploadedFilename
  379.      * @return $this
  380.      */
  381.     public function setUploadedFilename(?string $uploadedFilename): self
  382.     {
  383.         $this->uploadedFilename $uploadedFilename;
  384.         return $this;
  385.     }
  386.     /**
  387.      * @deprecated
  388.      *
  389.      * @return array|null
  390.      */
  391.     public function getColumns(): ?array
  392.     {
  393.         return $this->columns;
  394.     }
  395.     /**
  396.      * @deprecated
  397.      *
  398.      * @param array $columns
  399.      * @return $this
  400.      */
  401.     public function setColumns(array $columns): self
  402.     {
  403.         $this->columns $columns;
  404.         return $this;
  405.     }
  406.     /**
  407.      * @return bool
  408.      */
  409.     public function isSubsequent(): bool
  410.     {
  411.         return ($this->isIndexed() && ! empty($this->getLiveState()));
  412.     }
  413.     /**
  414.      * @return ImportState|null
  415.      */
  416.     public function getCurrentState(): ?ImportState
  417.     {
  418.         return $this->currentState;
  419.     }
  420.     /**
  421.      * @param ImportState|null $currentState
  422.      * @return $this
  423.      */
  424.     public function setCurrentState(?ImportState $currentState): self
  425.     {
  426.         $this->currentState $currentState;
  427.         return $this;
  428.     }
  429.     /**
  430.      * @return ImportState|null
  431.      */
  432.     public function getLiveState(): ?ImportState
  433.     {
  434.         return $this->liveState;
  435.     }
  436.     /**
  437.      * @param ImportState|null $liveState
  438.      * @return $this
  439.      */
  440.     public function setLiveState(?ImportState $liveState): self
  441.     {
  442.         $this->liveState $liveState;
  443.         return $this;
  444.     }
  445. }