prepare version 3.0

This commit is contained in:
DavidBadura 2016-03-12 10:23:18 +00:00
parent 3ca521bba3
commit ff17be5714
3 changed files with 41 additions and 3 deletions

View File

@ -25,12 +25,17 @@ php:
env: env:
global: global:
- TASKWARRIOR=2.5.0 - TASKWARRIOR=2.5.1
matrix: matrix:
- PREFER_LOWEST="--prefer-lowest" - PREFER_LOWEST="--prefer-lowest"
- PREFER_LOWEST="" - PREFER_LOWEST=""
matrix: matrix:
include:
- php: 7
env: TASKWARRIOR=2.5.0
- php: 5.6
env: TASKWARRIOR=2.5.0
allow_failures: allow_failures:
- php: hhvm - php: hhvm

View File

@ -21,7 +21,12 @@ Unfortunately, the annotation reader is not automatically registered on composer
## Requirements ## Requirements
Taskwarrior changes its behavior by patch level updates and it is very difficult to support all versions. Taskwarrior changes its behavior by patch level updates and it is very difficult to support all versions.
The current supported versions are: **>=2.4.3** The current supported versions are:
|PHP Lib|Taskwarrior|PHP Version|
|----|---------|------|
|2.x|>=2.4.3|>=5.4|
|3.x|>=2.5.0|>=5.5|
## Usage ## Usage
@ -29,6 +34,7 @@ The current supported versions are: **>=2.4.3**
use DavidBadura\Taskwarrior\TaskManager; use DavidBadura\Taskwarrior\TaskManager;
use DavidBadura\Taskwarrior\Task; use DavidBadura\Taskwarrior\Task;
use DavidBadura\Taskwarrior\Recurring; use DavidBadura\Taskwarrior\Recurring;
use DavidBadura\Taskwarrior\Annotation;
$tm = TaskManager::create(); $tm = TaskManager::create();
@ -39,6 +45,7 @@ $task->setDue('tomorrow');
$task->setPriority(Task::PRIORITY_HIGH); $task->setPriority(Task::PRIORITY_HIGH);
$task->addTag('next'); $task->addTag('next');
$task->setRecurring(Recurring::DAILY); $task->setRecurring(Recurring::DAILY);
$task->addAnnotation(new Annotation("and add many features"));
$tm->save($task); $tm->save($task);
@ -65,6 +72,7 @@ $tasks = $tm->filterByReport('waiting'); // and sorting
|due|true|DateTime| |due|true|DateTime|
|wait|true|DateTime| |wait|true|DateTime|
|tags|true|string[]| |tags|true|string[]|
|annotations|true|Annotation[]|
|urgency|false|float| |urgency|false|float|
|entry|false|DateTime| |entry|false|DateTime|
|start|false|DateTime| |start|false|DateTime|
@ -127,6 +135,15 @@ $tasks = $tm->filterPending('project:hobby and +home');
$tasks = $tm->filterPending(['project:hobby', '+home']); $tasks = $tm->filterPending(['project:hobby', '+home']);
``` ```
count tasks:
```php
$tasks = $tm->count('status:pending');
$tasks = $tm->count('status:pending +home');
$tasks = $tm->count('status:pending and +home');
$tasks = $tm->count(['status:pending', '+home']);
```
delete task: delete task:
```php ```php
@ -179,6 +196,22 @@ $task2 = $task1->getDependencies()[0];
echo $task2->getDesciption(); // "b" <- lazy loading echo $task2->getDesciption(); // "b" <- lazy loading
``` ```
annotations:
```php
$task = new Task();
$task->setDescription('a');
$task->addAnnotation(new Annotation("foobar"));
$tm->save($task);
$tm->clear(); // clear object cache
$task = $tm->find('uuid-from-task1');
$annotation = $task->getAnnotations()[0];
echo $annotation->getDesciption(); // "foobar"
```
### QueryBuilder ### QueryBuilder
example: example: