<?php
namespace Cms\FileBundle\Entity;
use Cms\ContainerBundle\Entity\Container;
use Cms\FileBundle\Entity\Nodes\Folder;
use Cms\TenantBundle\Entity\TenantedEntity;
use DateTime;
use Doctrine\ORM\Mapping as ORM;
use Platform\SecurityBundle\Entity\Identity\Account;
/**
* Class BulkUpload
* @package Cms\FileBundle\Entity
*
* @ORM\Entity(
* repositoryClass = "Cms\FileBundle\Doctrine\BulkUploadRepository"
* )
* @ORM\Table(
* name = "cms__file__bulk_upload"
* )
*/
class BulkUpload extends TenantedEntity
{
const STATUSES__ALLOCATED = 0;
const STATUSES__PROCESSING = 1;
const STATUSES__COMPLETE = 2;
const STATUSES = array(
self::STATUSES__ALLOCATED,
self::STATUSES__PROCESSING,
self::STATUSES__COMPLETE,
);
/**
* @var Account
*
* @ORM\ManyToOne(
* targetEntity = Account::class
* )
* @ORM\JoinColumn(
* name = "account",
* referencedColumnName = "id",
* onDelete = "CASCADE"
* )
*/
protected $account;
/**
* @var Container
*
* @ORM\ManyToOne(
* targetEntity = Container::class
* )
* @ORM\JoinColumn(
* name = "container",
* referencedColumnName = "id",
* onDelete = "CASCADE"
* )
*/
protected $container;
/**
* @var Folder
*
* @ORM\ManyToOne(
* targetEntity = Folder::class
* )
* @ORM\JoinColumn(
* name = "folder",
* referencedColumnName = "id",
* onDelete = "CASCADE"
* )
*/
protected $folder;
/**
* @var int
*
* @ORM\Column(
* type = "integer",
* nullable = false
* )
*/
protected $status = self::STATUSES__ALLOCATED;
/**
* @var string
*
* @ORM\Column(
* type = "string",
* nullable = true
* )
*/
protected $username;
/**
* @var string
*
* @ORM\Column(
* type = "text",
* nullable = true
* )
*/
protected $password;
/**
* @var DateTime
*
* @ORM\Column(
* type = "datetime",
* nullable = true
* )
*/
protected $expiration;
/**
* @return Account
*/
public function getAccount()
{
return $this->account;
}
/**
* @param Account $value
* @return $this
*/
public function setAccount(Account $value)
{
$this->account = $value;
return $this;
}
/**
* @return Container
*/
public function getContainer()
{
return $this->container;
}
/**
* @param Container $value
* @return $this
*/
public function setContainer(Container $value)
{
$this->container = $value;
return $this;
}
/**
* @return Folder|null
*/
public function getFolder()
{
return $this->folder;
}
/**
* @param Folder|null $value
* @return $this
*/
public function setFolder(Folder $value = null)
{
$this->folder = $value;
return $this;
}
/**
* @return string
*/
public function getUsername()
{
return $this->username;
}
/**
* @param string $value
* @return $this
*/
public function setUsername($value)
{
$this->username = $value;
return $this;
}
/**
* @return string
*/
public function getPassword()
{
return $this->password;
}
/**
* @param string $value
* @return $this
*/
public function setPassword($value)
{
$this->password = $value;
return $this;
}
/**
* @return DateTime|null
*/
public function getExpiration()
{
return $this->expiration;
}
/**
* @param DateTime|null $value
* @return $this
*/
public function setExpiration(DateTime $value = null)
{
$this->expiration = $value;
return $this;
}
/**
* @return int
*/
public function getStatus()
{
return $this->status;
}
/**
* @param int $value
* @return $this
* @throws \Exception
*/
public function setStatus($value)
{
if ( ! in_array($value, self::STATUSES)) {
throw new \Exception();
}
$this->status = $value;
return $this;
}
/**
* @param int $value
* @return bool
* @throws \Exception
*/
public function isStatus($value)
{
if ( ! in_array($value, self::STATUSES)) {
throw new \Exception();
}
return ($this->status === $value);
}
}