add recurring & fix until

This commit is contained in:
DavidBadura
2015-02-08 12:13:53 +00:00
parent 9ed7f6ff7c
commit 7199ad4dfa
4 changed files with 95 additions and 32 deletions

View File

@@ -14,6 +14,7 @@ class Task
const STATUS_COMPLETED = 'completed';
const STATUS_DELETED = 'deleted';
const STATUS_WAITING = 'waiting';
const STATUS_RECURRING = 'recurring';
const PRIORITY_LOW = 'L';
const PRIORITY_MEDIUM = 'M';
@@ -22,28 +23,28 @@ class Task
/**
* @var string
*
* @JMS\Type(name="string")
* @JMS\Type("string")
*/
private $uuid;
/**
* @var string
*
* @JMS\Type(name="string")
* @JMS\Type("string")
*/
private $description;
/**
* @var string
*
* @JMS\Type(name="string")
* @JMS\Type("string")
*/
private $priority;
/**
* @var string
*
* @JMS\Type(name="string")
* @JMS\Type("string")
*/
private $project;
@@ -61,24 +62,17 @@ class Task
*/
private $wait;
/**
* @var Carbon
*
* @JMS\Type("Carbon")
*/
private $until;
/**
* @var array
*
* @JMS\Type(name="array<string>")
* @JMS\Type("array<string>")
*/
private $tags;
/**
* @var float
*
* @JMS\Type(name="float")
* @JMS\Type("float")
*/
private $urgency;
@@ -89,6 +83,19 @@ class Task
*/
private $entry;
/**
* @var string
*
* @JMS\Type("string")
*/
private $recur;
/**
* @var Carbon
*
* @JMS\Type("Carbon")
*/
private $until;
/**
* @var Carbon
@@ -107,7 +114,7 @@ class Task
/**
* @var string
*
* @JMS\Type(name="string")
* @JMS\Type("string")
*/
private $status;
@@ -209,22 +216,6 @@ class Task
$this->wait = $this->parseDateTime($wait);
}
/**
* @return \DateTime
*/
public function getUntil()
{
return $this->until;
}
/**
* @param \DateTime|string $until
*/
public function setUntil($until = null)
{
$this->until = $this->parseDateTime($until);
}
/**
* @return array
*/
@@ -269,6 +260,38 @@ class Task
}
}
/**
* @return string
*/
public function getRecur()
{
return $this->recur;
}
/**
* @param string $recur
*/
public function setRecur($recur)
{
$this->recur = $recur;
}
/**
* @return \DateTime
*/
public function getUntil()
{
return $this->until;
}
/**
* @param \DateTime|string $until
*/
public function setUntil($until = null)
{
$this->until = $this->parseDateTime($until);
}
/**
* @return \DateTime
*/
@@ -341,6 +364,14 @@ class Task
return $this->status == self::STATUS_DELETED;
}
/**
* @return bool
*/
public function isReccuring()
{
return $this->status == self::STATUS_RECURRING;
}
/**
* @param string|\DateTime|null $date
* @return \DateTime|null