Skip to content

Instantly share code, notes, and snippets.

@fjugaldev
Created April 14, 2020 10:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fjugaldev/e0f7607a2a1184ef9e4cfb764c7c8d78 to your computer and use it in GitHub Desktop.
Save fjugaldev/e0f7607a2a1184ef9e4cfb764c7c8d78 to your computer and use it in GitHub Desktop.
<?php
/**
* Task.php
*
* Task Entity
*
* @category Entity
* @package MyKanban
* @author Francisco Ugalde
* @copyright 2018 www.franciscougalde.com
* @license http://www.php.net/license/3_0.txt PHP License 3.0
*/
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use DateTime;
use JMS\Serializer\Annotation as Serializer;
/**
* Task
* @ORM\Table(name="task")
* @ORM\Entity(repositoryClass="App\Repository\TaskRepository")
* @ORM\HasLifecycleCallbacks()
*/
class Task
{
/**
* @ORM\Column(name="id", type="integer")
* @ORM\Id()
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(name="title", type="string", length=150)
*/
protected $title;
/**
* @ORM\Column(name="description", type="text")
*/
protected $description;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Board", inversedBy="tasks")
* @ORM\JoinColumn(name="board_id", referencedColumnName="id")
* @Serializer\Exclude()
*
*/
protected $board;
/**
* @ORM\Column(name="status", type="string", length=50)
*/
protected $status;
/**
* @ORM\Column(name="priority", type="string", length=10)
*/
protected $priority;
/**
* @ORM\Column(name="created_at", type="datetime")
*/
protected $createdAt;
/**
* @ORM\Column(name="updated_at", type="datetime")
*/
protected $updatedAt;
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* @return mixed
*/
public function getTitle()
{
return $this->title;
}
/**
* @param mixed $title
*/
public function setTitle($title)
{
$this->title = $title;
}
/**
* @return mixed
*/
public function getDescription()
{
return $this->description;
}
/**
* @param mixed $description
*/
public function setDescription($description)
{
$this->description = $description;
}
/**
* @return mixed
*/
public function getBoard()
{
return $this->board;
}
/**
* @param mixed $board
*/
public function setBoard($board)
{
$this->board = $board;
}
/**
* @return mixed
*/
public function getStatus()
{
return $this->status;
}
/**
* @param mixed $status
*/
public function setStatus($status)
{
$this->status = $status;
}
/**
* @return mixed
*/
public function getPriority()
{
return $this->priority;
}
/**
* @param mixed $priority
*/
public function setPriority($priority)
{
$this->priority = $priority;
}
/**
* @return mixed
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* @param mixed $createdAt
*/
public function setCreatedAt($createdAt)
{
$this->createdAt = $createdAt;
}
/**
* @return mixed
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}
/**
* @param mixed $updatedAt
*/
public function setUpdatedAt($updatedAt)
{
$this->updatedAt = $updatedAt;
}
/**
* @ORM\PrePersist
* @ORM\PreUpdate
*/
public function updatedTimestamps()
{
$dateTimeNow = new DateTime('now');
$this->setUpdatedAt($dateTimeNow);
if ($this->getCreatedAt() === null) {
$this->setCreatedAt($dateTimeNow);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment