Fix fetch with empty args to return everything

This commit is contained in:
Leo Germani 2017-12-01 16:57:15 -02:00
parent 4ac33d8819
commit 20b56854a3
5 changed files with 9 additions and 7 deletions

View File

@ -178,7 +178,7 @@ class Filters extends Repository {
public function fetch($args = [], $output = null){
if( is_numeric($args) ){
return new Entities\Filter($args);
} elseif (!empty($args)) {
} elseif (is_array($args)) {
// TODO: get filters from parent collections
$args = array_merge([
'posts_per_page' => -1,

View File

@ -61,8 +61,10 @@ class Items extends Repository {
}
// register taxonomies
foreach ($taxonomies as $taxonomy) {
$taxonomy->register_taxonomy();
if (is_array($taxonomies) && sizeof($taxonomies) > 0) {
foreach ($taxonomies as $taxonomy) {
$taxonomy->register_taxonomy();
}
}
}

View File

@ -124,7 +124,7 @@ class Logs extends Repository {
public function fetch($args = [], $output = null){
if(is_numeric($args)){
return new Entities\Log($args);
} else {
} elseif (is_array($args)) {
$args = array_merge([
'post_status' => 'publish',
], $args);

View File

@ -202,7 +202,7 @@ class Metadatas extends Repository {
if( is_numeric($args) ){
return new Entities\Metadata($args);
} elseif (!empty($args)) {
} elseif (is_array($args)) {
$args = array_merge([
'posts_per_page' => -1,

View File

@ -163,7 +163,7 @@ class Taxonomies extends Repository {
if( is_numeric($args) ){
return new Entities\Taxonomy($args);
} elseif (!empty($args)) {
} elseif (is_array($args)) {
$args = array_merge([
'posts_per_page' => -1,