add more query builder features
This commit is contained in:
parent
a0ca517981
commit
43318c7c0e
@ -39,3 +39,12 @@ $tasks = $tm->filter('project:hobby'); // empty
|
||||
## API
|
||||
|
||||
todo...
|
||||
|
||||
### QueryBuilder
|
||||
|
||||
```php
|
||||
$tasks = $taskManager->createQueryBuilder()
|
||||
->whereProject('hobby')
|
||||
->sortBy(QueryBuilder::SORT_ENTRY)
|
||||
->getResult()
|
||||
```
|
@ -63,6 +63,30 @@ class QueryBuilder
|
||||
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
|
||||
* @return $this
|
||||
@ -72,6 +96,46 @@ class QueryBuilder
|
||||
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
|
||||
* @return $this
|
||||
|
Loading…
Reference in New Issue
Block a user