ContentManager
class ContentManager extends BaseManager
Core content manager
Methods
Helps paginate models using the query bulder. Bit more complicated than the native array method, but works better for larger data sets
Find content
Find first based on params
Find first content by ID
No description
Find first content item by given URL.
Find first item by given UUID
Find first instance by SRN
No description
No description
No description
Create content with given properties.
Update content object.
Delete content item
Attach a file to a content item File is an array containing: * file - BASE64 encoded file content * name - original file name
No description
No description
Details
in BaseManager at line line 23
object
save(object $obj)
Save handler, because DRY
in BaseManager at line line 60
Paginator
getPaginator(integer $page = 1, integer $limit = 50)
Helps paginate models using the query bulder. Bit more complicated than the native array method, but works better for larger data sets
Because it's based on Phalcon's QueryBuilder, it supports a fluent filtering interface:
$manager = $this->foo_manager; $items = $manager->getPaginator(1, 20) ->orderBy('created_at desc') ->where('name = :name:', array('name' => $name)) ->andWhere('type = :type:', array('type' => $type)) ->paginate(); echo json_encode($items);
in BaseManager at line line 80
boolean
restDelete(number $id)
Delete an object with rest
in BaseManager at line line 103
restCreate(array $data)
Create a new object
in BaseManager at line line 117
restUpdate(int $id, array $data)
Update an existing object
at line line 30
mixed
find(mixed $parameters = null)
Find content
at line line 40
mixed
findFirst(mixed $params = null)
Find first based on params
at line line 50
mixed
findFirstById(mixed $params = null)
Find first content by ID
at line line 55
findById($params = null)
at line line 76
object
findFirstByUrl(mixed $url)
Find first content item by given URL.
URL can either be a full URL slug or URL object. For example both of the following are valid:
$content = ContentManager::findFirstByUrl('some/path'); $url = UrlModel::findFirstBySlug('another/path'); $content = ContentManager::findFirstByUrl($url);
at line line 104
object
findFirstByUuid(string $uuid)
Find first item by given UUID
at line line 114
Content
findFirstBySrn(string $srn)
Find first instance by SRN
at line line 124
findRelatedByKeywords($keywords = array(), $minRank = 1.0)
at line line 128
findRelatedByContent($content)
at line line 172
getUrlSlug($content)
at line line 234
object
create($input, $user = false, $nopush = false)
Create content with given properties.
- slug
- version
- abstract
- content
- state
- urls
- attachment
URLS can be provided either as a single string, or an array with: * url * is_default
For example:
$data = [ 'slug' => 'fronch-toast'.uniqid(), 'urls' => [ 'a-test-url'.uniqid(), [ 'url' => 'another test url'.uniqid(), 'is_default' => 1 ] ] ];
Attachment is an array containing: * file - BASE64 encoded file data * name - original file name
at line line 566
object
update($id, $input, $user = false, $nopush = false)
Update content object.
Accepts the same properties as create, including Urls. Keep in mind that Url associations are permanent. You may only append new Urls, existing Urls will always be maintained.
Will also create a new version containing all of the current data, before save.
Additionally, sending an attachment will remove the original attachment and replace with the new file.
at line line 931
delete(int $id)
Delete content item
at line line 963
Attachment
attach(integer $id, array $file, array $iptcData = array())
Attach a file to a content item File is an array containing: * file - BASE64 encoded file content * name - original file name