Contentful Feed Builder
<?php | |
class ContentfulBuilder { | |
protected $query; | |
public function __construct() { | |
$this->query = new Query; | |
} | |
public function setContentType($content_type) { | |
$this->query->setContentType($content_type); | |
return $this; | |
} | |
public function where($query) | |
{ | |
if (is_array($query)) { | |
foreach ($query as $key => $value) { | |
$this->query->where("fields.$key", $value); | |
} | |
} | |
return $this; | |
} | |
public function get() | |
{ | |
return $this->query; | |
} | |
} |
<?php | |
$query = (new ContentfulBuilder)->setContentType('gameAssetCarousel')->where([ | |
'namespace' => 'foo', | |
'tags' => 'foo_index', | |
])->get(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment