finish annotation supprt

This commit is contained in:
DavidBadura
2016-03-12 10:04:31 +00:00
parent ece82c24a9
commit d506df75ae
3 changed files with 72 additions and 3 deletions

View File

@@ -24,6 +24,15 @@ class Annotation
*/
private $entry;
/**
* @param string $description
*/
public function __construct($description = null)
{
$this->entry = new Carbon(); // todo https://bug.tasktools.org/browse/TW-1780
$this->description = $description;
}
/**
* @return string
*/

View File

@@ -111,7 +111,7 @@ class Task
*
* @JMS\Type("array<DavidBadura\Taskwarrior\Annotation>")
*/
private $annotations;
private $annotations = [];
/**
* @var Carbon
@@ -364,7 +364,7 @@ class Task
*/
public function getAnnotations()
{
return $this->annotations;
return (array)$this->annotations;
}
/**
@@ -394,8 +394,9 @@ class Task
*/
public function removeAnnotation(Annotation $annotation)
{
if ($key = array_search($annotation, $this->annotations)) {
if (false !== $key = array_search($annotation, $this->annotations)) {
unset($this->annotations[$key]);
$this->annotations = array_values($this->annotations);
}
}