Made ARG_QUERY optional
This commit is contained in:
parent
ae12fdeaec
commit
561ebd5508
5 changed files with 20 additions and 12 deletions
|
@ -19,7 +19,9 @@ class GetLogJob extends AbstractJob implements IPagedJob
|
||||||
$pageSize = $this->pager->getPageSize();
|
$pageSize = $this->pager->getPageSize();
|
||||||
$page = $this->pager->getPageNumber();
|
$page = $this->pager->getPageNumber();
|
||||||
$name = $this->getArgument(JobArgs::ARG_LOG_ID);
|
$name = $this->getArgument(JobArgs::ARG_LOG_ID);
|
||||||
$query = $this->getArgument(JobArgs::ARG_QUERY);
|
$query = $this->hasArgument(JobArgs::ARG_QUERY)
|
||||||
|
? $this->getArgument(JobArgs::ARG_QUERY)
|
||||||
|
: '';
|
||||||
|
|
||||||
//parse input
|
//parse input
|
||||||
$page = max(1, intval($page));
|
$page = max(1, intval($page));
|
||||||
|
@ -53,7 +55,7 @@ class GetLogJob extends AbstractJob implements IPagedJob
|
||||||
return JobArgs::Conjunction(
|
return JobArgs::Conjunction(
|
||||||
$this->pager->getRequiredArguments(),
|
$this->pager->getRequiredArguments(),
|
||||||
JobArgs::ARG_LOG_ID,
|
JobArgs::ARG_LOG_ID,
|
||||||
JobArgs::ARG_QUERY);
|
JobArgs::Optional(JobArgs::ARG_QUERY));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getRequiredPrivileges()
|
public function getRequiredPrivileges()
|
||||||
|
|
|
@ -18,7 +18,9 @@ class ListPostsJob extends AbstractJob implements IPagedJob
|
||||||
{
|
{
|
||||||
$pageSize = $this->pager->getPageSize();
|
$pageSize = $this->pager->getPageSize();
|
||||||
$page = $this->pager->getPageNumber();
|
$page = $this->pager->getPageNumber();
|
||||||
$query = $this->getArgument(JobArgs::ARG_QUERY);
|
$query = $this->hasArgument(JobArgs::ARG_QUERY)
|
||||||
|
? $this->getArgument(JobArgs::ARG_QUERY)
|
||||||
|
: '';
|
||||||
|
|
||||||
$posts = PostSearchService::getEntities($query, $pageSize, $page);
|
$posts = PostSearchService::getEntities($query, $pageSize, $page);
|
||||||
$postCount = PostSearchService::getEntityCount($query);
|
$postCount = PostSearchService::getEntityCount($query);
|
||||||
|
@ -32,7 +34,7 @@ class ListPostsJob extends AbstractJob implements IPagedJob
|
||||||
{
|
{
|
||||||
return JobArgs::Conjunction(
|
return JobArgs::Conjunction(
|
||||||
$this->pager->getRequiredArguments(),
|
$this->pager->getRequiredArguments(),
|
||||||
JobArgs::ARG_QUERY);
|
JobArgs::Optional(JobArgs::ARG_QUERY));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getRequiredPrivileges()
|
public function getRequiredPrivileges()
|
||||||
|
|
|
@ -18,7 +18,9 @@ class ListTagsJob extends AbstractJob implements IPagedJob
|
||||||
{
|
{
|
||||||
$pageSize = $this->pager->getPageSize();
|
$pageSize = $this->pager->getPageSize();
|
||||||
$page = $this->pager->getPageNumber();
|
$page = $this->pager->getPageNumber();
|
||||||
$query = $this->getArgument(JobArgs::ARG_QUERY);
|
$query = $this->hasArgument(JobArgs::ARG_QUERY)
|
||||||
|
? $this->getArgument(JobArgs::ARG_QUERY)
|
||||||
|
: '';
|
||||||
|
|
||||||
$tags = TagSearchService::getEntities($query, $pageSize, $page);
|
$tags = TagSearchService::getEntities($query, $pageSize, $page);
|
||||||
$tagCount = TagSearchService::getEntityCount($query);
|
$tagCount = TagSearchService::getEntityCount($query);
|
||||||
|
@ -30,7 +32,7 @@ class ListTagsJob extends AbstractJob implements IPagedJob
|
||||||
{
|
{
|
||||||
return JobArgs::Conjunction(
|
return JobArgs::Conjunction(
|
||||||
$this->pager->getRequiredArguments(),
|
$this->pager->getRequiredArguments(),
|
||||||
JobArgs::ARG_QUERY);
|
JobArgs::Optional(JobArgs::ARG_QUERY));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getRequiredPrivileges()
|
public function getRequiredPrivileges()
|
||||||
|
|
|
@ -18,7 +18,9 @@ class ListUsersJob extends AbstractJob implements IPagedJob
|
||||||
{
|
{
|
||||||
$pageSize = $this->pager->getPageSize();
|
$pageSize = $this->pager->getPageSize();
|
||||||
$page = $this->pager->getPageNumber();
|
$page = $this->pager->getPageNumber();
|
||||||
$filter = $this->getArgument(JobArgs::ARG_QUERY);
|
$filter = $this->hasArgument(JobArgs::ARG_QUERY)
|
||||||
|
? $this->getArgument(JobArgs::ARG_QUERY)
|
||||||
|
: '';
|
||||||
|
|
||||||
$users = UserSearchService::getEntities($filter, $pageSize, $page);
|
$users = UserSearchService::getEntities($filter, $pageSize, $page);
|
||||||
$userCount = UserSearchService::getEntityCount($filter);
|
$userCount = UserSearchService::getEntityCount($filter);
|
||||||
|
@ -30,7 +32,7 @@ class ListUsersJob extends AbstractJob implements IPagedJob
|
||||||
{
|
{
|
||||||
return JobArgs::Conjunction(
|
return JobArgs::Conjunction(
|
||||||
$this->pager->getRequiredArguments(),
|
$this->pager->getRequiredArguments(),
|
||||||
JobArgs::ARG_QUERY);
|
JobArgs::Optional(JobArgs::ARG_QUERY));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getRequiredPrivileges()
|
public function getRequiredPrivileges()
|
||||||
|
|
|
@ -179,7 +179,7 @@ class ApiArgumentTest extends AbstractFullApiTest
|
||||||
{
|
{
|
||||||
$this->testArguments(new GetLogJob(),
|
$this->testArguments(new GetLogJob(),
|
||||||
JobArgs::Conjunction(
|
JobArgs::Conjunction(
|
||||||
JobArgs::ARG_QUERY,
|
JobArgs::Optional(JobArgs::ARG_QUERY),
|
||||||
JobArgs::ARG_LOG_ID,
|
JobArgs::ARG_LOG_ID,
|
||||||
JobArgs::Optional(JobArgs::ARG_PAGE_NUMBER)));
|
JobArgs::Optional(JobArgs::ARG_PAGE_NUMBER)));
|
||||||
}
|
}
|
||||||
|
@ -227,7 +227,7 @@ class ApiArgumentTest extends AbstractFullApiTest
|
||||||
{
|
{
|
||||||
$this->testArguments(new ListPostsJob(),
|
$this->testArguments(new ListPostsJob(),
|
||||||
JobArgs::Conjunction(
|
JobArgs::Conjunction(
|
||||||
JobArgs::ARG_QUERY,
|
JobArgs::Optional(JobArgs::ARG_QUERY),
|
||||||
JobArgs::Optional(JobArgs::ARG_PAGE_NUMBER)));
|
JobArgs::Optional(JobArgs::ARG_PAGE_NUMBER)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,7 +244,7 @@ class ApiArgumentTest extends AbstractFullApiTest
|
||||||
{
|
{
|
||||||
$this->testArguments(new ListTagsJob(),
|
$this->testArguments(new ListTagsJob(),
|
||||||
JobArgs::Conjunction(
|
JobArgs::Conjunction(
|
||||||
JobArgs::ARG_QUERY,
|
JobArgs::Optional(JobArgs::ARG_QUERY),
|
||||||
JobArgs::Optional(JobArgs::ARG_PAGE_NUMBER)));
|
JobArgs::Optional(JobArgs::ARG_PAGE_NUMBER)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,7 +252,7 @@ class ApiArgumentTest extends AbstractFullApiTest
|
||||||
{
|
{
|
||||||
$this->testArguments(new ListUsersJob(),
|
$this->testArguments(new ListUsersJob(),
|
||||||
JobArgs::Conjunction(
|
JobArgs::Conjunction(
|
||||||
JobArgs::ARG_QUERY,
|
JobArgs::Optional(JobArgs::ARG_QUERY),
|
||||||
JobArgs::Optional(JobArgs::ARG_PAGE_NUMBER)));
|
JobArgs::Optional(JobArgs::ARG_PAGE_NUMBER)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue