src/Entity/Node.php line 15
<?php
namespace App\Entity;
use DateTime;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints\Json;
/**
* Node
*/
#[ORM\Table(name: 'node', options: ['comment' => "Table with node''s definition. Each node in scenario correnspond to one row."])]
#[ORM\Index(name: 'IDX_857FE845E04E49DF', columns: ['scenario_id'])]
#[ORM\Entity]
class Node
{
#[ORM\Column(name: 'id', type: 'integer', options: ['comment' => 'ID'])]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'SEQUENCE')]
#[ORM\SequenceGenerator(sequenceName: 'seq_node_id', allocationSize: 1, initialValue: 1)]
private int $id;
#[ORM\Column(name: 'title', type: 'string', length: 255, nullable: false, options: ['comment' => 'Title'])]
private string $title;
#[ORM\Column(name: 'description', type: 'text', nullable: false, options: ['comment' => 'Description'])]
private string $description;
#[ORM\Column(name: 'additional_description', type: 'text', nullable: true, options: ['comment' => 'Additonal description'])]
private ?string $additionalDescription;
#[ORM\Column(name: 'question', type: 'text', nullable: false, options: ['default' => '', 'comment' => 'Question'])]
private string $question;
/**
* @var integer
*/
#[ORM\Column(name: 'links_order', type: 'integer', nullable: false, options: ['default' => 0, 'comment' => 'Order of links (0 - default, 1 - random)'])]
private $linksOrder = '0';
#[ORM\Column(name: 'parameters', type: 'json', nullable: false, options: ['comment' => 'Parameters of patient (json)'])]
private $parameters;
/**
* @var integer
*/
#[ORM\Column(name: 'node_order', type: 'integer', nullable: false, options: ['default' => 0, 'comment' => 'Order in scenario'])]
private $nodeOrder = '0';
/**
* @var integer
*/
#[ORM\Column(name: 'active', type: 'boolean', nullable: false, options: ['default' => false, 'comment' => 'Active'])]
private $active = false;
#[ORM\Column(name: 'is_deleted', type: 'boolean', nullable: false, options: ['default' => false, 'comment' => 'Not deleted?'])]
private bool $isDeleted = false; //comment is only for Adminer, false is still not deleted a otherwise
#[ORM\Column(name: 'created_at', type: 'datetime', nullable: false, options: ['comment' => 'Created at', 'default' => 'now()'])]
private DateTime $createdAt;
#[ORM\Column(name: 'lastmod_at', type: 'datetime', nullable: true)]
private ?DateTime $lastmodAt;
#[ORM\ManyToOne(targetEntity: 'App\Entity\Scenario')]
#[ORM\JoinColumn(name: 'scenario_id', referencedColumnName: 'id')]
private Scenario $scenario;
#[ORM\Column(name: 'scenario_id', type: 'integer', nullable: false, options: ['comment' => 'Scenario'])]
private int $scenarioId;
#[ORM\ManyToOne(targetEntity: 'App\Entity\Users')]
#[ORM\JoinColumn(name: 'users_id', referencedColumnName: 'id', nullable: false)]
private Users $users;
#[ORM\Column(name: 'users_id', type: 'integer', nullable: false, options: ['comment' => 'Creating/editing user'])]
protected int $usersId;
/**
* Set title
*
* @param string $title
*
* @return Node
*/
public function setTitle(string $title): Node
{
$this->title = $title;
return $this;
}
/**
* Get title
*
* @return string
*/
public function getTitle(): string
{
return $this->title;
}
/**
* Set additional description
*
* @param string $additionalDescription
* @return Node
*/
public function setAdditionalDescription(string $additionalDescription): Node
{
$this->additionalDescription = $additionalDescription;
return $this;
}
/**
* Get additional description
*
* @return string|null
*/
public function getAdditionalDescription(): ?string
{
return $this->additionalDescription;
}
/**
* Set description
*
* @param string $description
*
* @return Node
*/
public function setDescription(string $description): Node
{
$this->description = $description;
return $this;
}
/**
* Get description
*
* @return string
*/
public function getDescription(): string
{
return $this->description;
}
/**
* Set linksOrder
*
* @param integer $linksOrder
*
* @return Node
*/
public function setLinksOrder(int $linksOrder): Node
{
$this->linksOrder = $linksOrder;
return $this;
}
/**
* Get linksOrder
*
* @return integer
*/
public function getLinksOrder()
{
return $this->linksOrder;
}
/**
* Set parameters
*
* @param array $parameters
*
* @return Node
*/
public function setParameters($parameters)
{
$this->parameters = $parameters;
return $this;
}
/**
* Get parameters
*
* @return array
*/
public function getParameters()
{
return $this->parameters;
}
/**
* Set nodeOrder
*
* @param integer $nodeOrder
*
* @return Node
*/
public function setNodeOrder(int $nodeOrder): Node
{
$this->nodeOrder = $nodeOrder;
return $this;
}
/**
* Get nodeOrder
*
* @return integer
*/
public function getNodeOrder()
{
return $this->nodeOrder;
}
/**
* Set active
*
* @param boolean $active
*
* @return Node
*/
public function setActive(bool $active): Node
{
$this->active = $active;
return $this;
}
/**
* Get active
*
* @return boolean
*/
public function getActive()
{
return $this->active;
}
/**
* Set isDeleted
*
* @param boolean $isDeleted
*
* @return Node
*/
public function setIsDeleted(bool $isDeleted): Node
{
$this->isDeleted = $isDeleted;
return $this;
}
/**
* Get isDeleted
*
* @return boolean
*/
public function getIsDeleted(): bool
{
return $this->isDeleted;
}
/**
* Set createdAt
*
* @param DateTime $createdAt
*
* @return Node
*/
public function setCreatedAt(DateTime $createdAt): Node
{
$this->createdAt = $createdAt;
return $this;
}
/**
* Get createdAt
*
* @return DateTime
*/
public function getCreatedAt(): DateTime
{
return $this->createdAt;
}
/**
* Set lastmodAt
*
* @param DateTime|null $lastmodAt
* @return Node
*/
public function setLastmodAt(DateTime $lastmodAt = null): Node
{
$this->lastmodAt = $lastmodAt;
return $this;
}
/**
* Get lastmodAt
*
* @return DateTime|null
*/
public function getLastmodAt(): ?DateTime
{
return $this->lastmodAt;
}
/**
* Get id
*
* @return integer
*/
public function getId(): int
{
return $this->id;
}
/**
* Set scenario
*
* @param Scenario|null $scenario
*
* @return Node
*/
public function setScenario(Scenario $scenario = null): Node
{
$this->scenario = $scenario;
return $this;
}
/**
* Get scenario
*
* @return Scenario
*/
public function getScenario(): Scenario
{
return $this->scenario;
}
/**
* Set scenarioId
*
* @param integer $scenarioId
*
* @return Node
*/
public function setScenarioId(int $scenarioId): Node
{
$this->scenarioId = $scenarioId;
return $this;
}
/**
* Get scenarioId
*
* @return integer
*/
public function getScenarioId(): int
{
return $this->scenarioId;
}
/**
* @return string
*/
public function getQuestion(): string
{
return $this->question;
}
/**
* @param string $question
*/
public function setQuestion(string $question)
{
$this->question = $question;
}
/**
* Set users
*
* @param Users|null $users
*
* @return Node
*/
public function setUsers(Users $users = null): Node
{
$this->users = $users;
$this->usersId = $users->getId();
return $this;
}
/**
* Get users
*
* @return Users
*/
public function getUsers(): Users
{
return $this->users;
}
/**
* Set usersId
*
* @param integer $usersId
*
* @return Node
*/
public function setUsersId(int $usersId): Node
{
$this->usersId = $usersId;
return $this;
}
/**
* Get usersId
*
* @return integer
*/
public function getUsersId(): int
{
return $this->usersId;
}
/**
* @return string
*/
public function encodeNodeId(): string
{
return base64_encode($this->getId());
}
/**
* @param $id
* @return false|string
*/
public static function staticDecode($id){
return base64_decode($id);
}
}