add more query builder features

This commit is contained in:
DavidBadura 2015-04-06 22:03:22 +00:00
parent a0ca517981
commit 43318c7c0e
2 changed files with 73 additions and 0 deletions

View File

@ -39,3 +39,12 @@ $tasks = $tm->filter('project:hobby'); // empty
## API ## API
todo... todo...
### QueryBuilder
```php
$tasks = $taskManager->createQueryBuilder()
->whereProject('hobby')
->sortBy(QueryBuilder::SORT_ENTRY)
->getResult()
```

View File

@ -63,6 +63,30 @@ class QueryBuilder
return $this->where('priority:' . $priority); return $this->where('priority:' . $priority);
} }
/**
* @return $this
*/
public function wherePriorityL()
{
return $this->wherePriority(Task::PRIORITY_LOW);
}
/**
* @return $this
*/
public function wherePriorityM()
{
return $this->wherePriority(Task::PRIORITY_MEDIUM);
}
/**
* @return $this
*/
public function wherePriorityH()
{
return $this->wherePriority(Task::PRIORITY_HIGH);
}
/** /**
* @param string $status * @param string $status
* @return $this * @return $this
@ -72,6 +96,46 @@ class QueryBuilder
return $this->where('status:' . $status); return $this->where('status:' . $status);
} }
/**
* @return $this
*/
public function wherePending()
{
return $this->whereStatus(Task::STATUS_PENDING);
}
/**
* @return $this
*/
public function whereWaiting()
{
return $this->whereStatus(Task::STATUS_WAITING);
}
/**
* @return $this
*/
public function whereCompleted()
{
return $this->whereStatus(Task::STATUS_COMPLETED);
}
/**
* @return $this
*/
public function whereRecurring()
{
return $this->whereStatus(Task::STATUS_RECURRING);
}
/**
* @return $this
*/
public function whereDeleted()
{
return $this->whereStatus(Task::STATUS_DELETED);
}
/** /**
* @param string $where * @param string $where
* @return $this * @return $this