This commit is contained in:
DavidBadura
2015-02-06 17:31:13 +00:00
parent b81cad6243
commit a58ceedefc
5 changed files with 92 additions and 5 deletions

View File

@@ -14,9 +14,9 @@ class Task
const STATUS_DELETED = 'deleted';
const STATUS_WAITING = 'waiting';
const PRIORITY_LOW = 'L';
const PRIORITY_LOW = 'L';
const PRIORITY_MEDIUM = 'M';
const PRIORITY_HIGH = 'H';
const PRIORITY_HIGH = 'H';
/**
* @var string
@@ -53,6 +53,13 @@ class Task
*/
private $due;
/**
* @var array
*
* @JMS\Type(name="array<string>")
*/
private $tags;
/**
* @var float
*
@@ -156,6 +163,42 @@ class Task
$this->due = $due;
}
/**
* @return array
*/
public function getTags()
{
return (array)$this->tags;
}
/**
* @param array $tags
*/
public function setTags(array $tags = array())
{
$this->tags = $tags;
}
/**
* @param string $tag
*/
public function addTag($tag)
{
if (!in_array($tag, $this->tags)) {
$this->tags[] = $tag;
}
}
/**
* @param string $tag
*/
public function removeTag($tag)
{
if (false !== $key = array_search($tag, $this->tags)) {
unset($this->tags[$key]);
}
}
/**
* @return \DateTime
*/