<?php
namespace Cms\ImportBundle\Entity;
use Cms\TenantBundle\Entity\TenantedEntity;
use DateTimeInterface;
use Doctrine\ORM\Mapping as ORM;
/**
* An Import within the system of data of a certain type.
* Controls the basic functioning of an import.
* Most data concerning actual import actions are held within the ImportState entity.
*
* Class Import
* @package Cms\ImportBundle\Entity
*
* @ORM\Entity(
* repositoryClass = "Cms\ImportBundle\Doctrine\ImportRepository"
* )
* @ORM\Table(
* name = "cms__import__import"
* )
*/
class Import extends TenantedEntity
{
/**
* The name of the import for quick reference.
*
* @var string
*
* @ORM\Column(
* type = "string",
* nullable = false,
* )
*/
protected $name;
/**
* A more detailed description of what the import is for.
*
* @var string|null
*
* @ORM\Column(
* type = "text",
* nullable = true,
* )
*/
protected $description = null;
/**
* The type of data covered with the import.
*
* @var string
*
* @ORM\Column(
* type = "string",
* nullable = false,
* )
*/
protected $type;
/**
* @deprecated
*
* @var array
*
* @ORM\Column(
* type = "json",
* nullable = false,
* )
*/
protected $mappings = [];
/**
* @deprecated
*
* @var DateTimeInterface|null
*
* @ORM\Column(
* type = "datetime",
* nullable = true,
* )
*/
protected $processedAt = null;
/**
* @deprecated
*
* @var DateTimeInterface|null
*
* @ORM\Column(
* type = "datetime",
* nullable = true,
* )
*/
protected $uploadedAt = null;
/**
* @deprecated
*
* @var string|null
*
* @ORM\Column(
* type = "string",
* nullable = true,
* )
*/
protected $uploadedType = null;
/**
* @deprecated
*
* @var string|null
*
* @ORM\Column(
* type = "string",
* nullable = true,
* )
*/
protected $uploadedFilename = null;
/**
* @deprecated
*
* @var int
*
* @ORM\Column(
* type = "integer",
* nullable = true,
* )
*/
protected $processingTime = 0;
/**
* @deprecated
*
* @var array
*
* @ORM\Column(
* type = "array",
* nullable = true,
* )
*/
protected $columns = [];
/**
* 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.
*
* @var bool
*
* @ORM\Column(
* type = "boolean",
* nullable = false,
* options = {
* "default" = false,
* },
* )
*/
protected $indexed = false;
/**
* @var ImportState
*
* @ORM\OneToOne(
* targetEntity = ImportState::class,
* )
* @ORM\JoinColumn(
* name = "currentState",
* referencedColumnName = "id",
* onDelete = "SET NULL",
* nullable = true,
* )
*/
protected $currentState = null;
/**
* @var ImportState
*
* @ORM\OneToOne(
* targetEntity = ImportState::class,
* )
* @ORM\JoinColumn(
* name = "liveState",
* referencedColumnName = "id",
* onDelete = "SET NULL",
* nullable = true,
* )
*/
protected $liveState = null;
/**
* @deprecated
*
* @return bool
*/
public function isMapped(): bool
{
return ( ! empty($this->getMappings()));
}
/**
* @deprecated
*
* @return bool
*/
public function isUploaded(): bool
{
return ($this->getUploadedAt() instanceof DateTimeInterface);
}
/**
* @deprecated
*
* @return bool
*/
public function isProcessed(): bool
{
return ($this->getProcessedAt() instanceof DateTimeInterface);
}
/**
* @return bool
*/
public function isIndexed(): bool
{
return ($this->indexed === true);
}
/**
* @param bool $indexed
* @return $this
*/
public function setIndexed(bool $indexed): self
{
$this->indexed = ($indexed === true);
return $this;
}
/**
* @deprecated
*
* @return int
*/
public function getProcessingTime(): int
{
return $this->processingTime ?? 0;
}
/**
* @deprecated
*
* @param int $processingTime
* @return $this
*/
public function setProcessingTime(int $processingTime): self
{
$this->processingTime = $processingTime;
return $this;
}
/**
* @return string|null
*/
public function getName(): ?string
{
return $this->name;
}
/**
* @param string $name
* @return $this
*/
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
/**
* @return string|null
*/
public function getDescription(): ?string
{
return $this->description;
}
/**
* @param string|null $description
* @return $this
*/
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
/**
* @return string
*/
public function getType(): string
{
return $this->type;
}
/**
* @param string $type
* @return $this
*/
public function setType(string $type): self
{
$this->type = $type;
return $this;
}
/**
* @deprecated
*
* @return array
*/
public function getMappings(): array
{
return $this->mappings;
}
/**
* @deprecated
*
* @param array $mappings
* @return $this
*/
public function setMappings(array $mappings): self
{
$this->mappings = $mappings;
return $this;
}
/**
* @deprecated
*
* @return DateTimeInterface|null
*/
public function getProcessedAt(): ?DateTimeInterface
{
return $this->processedAt;
}
/**
* @deprecated
*
* @param DateTimeInterface|null $processedAt
* @return $this
*/
public function setProcessedAt(?DateTimeInterface $processedAt): self
{
$this->processedAt = $processedAt;
return $this;
}
/**
* @deprecated
*
* @return DateTimeInterface|null
*/
public function getUploadedAt(): ?DateTimeInterface
{
return $this->uploadedAt;
}
/**
* @deprecated
*
* @param DateTimeInterface|null $uploadedAt
* @return $this
*/
public function setUploadedAt(?DateTimeInterface $uploadedAt): self
{
$this->uploadedAt = $uploadedAt;
return $this;
}
/**
* @deprecated
*
* @return string|null
*/
public function getUploadedType(): ?string
{
return $this->uploadedType;
}
/**
* @deprecated
*
* @param string|null $uploadedType
* @return $this
*/
public function setUploadedType(?string $uploadedType): self
{
$this->uploadedType = $uploadedType;
return $this;
}
/**
* @deprecated
*
* @return string|null
*/
public function getUploadedFilename(): ?string
{
return $this->uploadedFilename;
}
/**
* @deprecated
*
* @param string|null $uploadedFilename
* @return $this
*/
public function setUploadedFilename(?string $uploadedFilename): self
{
$this->uploadedFilename = $uploadedFilename;
return $this;
}
/**
* @deprecated
*
* @return array|null
*/
public function getColumns(): ?array
{
return $this->columns;
}
/**
* @deprecated
*
* @param array $columns
* @return $this
*/
public function setColumns(array $columns): self
{
$this->columns = $columns;
return $this;
}
/**
* @return bool
*/
public function isSubsequent(): bool
{
return ($this->isIndexed() && ! empty($this->getLiveState()));
}
/**
* @return ImportState|null
*/
public function getCurrentState(): ?ImportState
{
return $this->currentState;
}
/**
* @param ImportState|null $currentState
* @return $this
*/
public function setCurrentState(?ImportState $currentState): self
{
$this->currentState = $currentState;
return $this;
}
/**
* @return ImportState|null
*/
public function getLiveState(): ?ImportState
{
return $this->liveState;
}
/**
* @param ImportState|null $liveState
* @return $this
*/
public function setLiveState(?ImportState $liveState): self
{
$this->liveState = $liveState;
return $this;
}
}