class MentionManager extends BaseManager

Mention manager handles parsing mentions from text, association with models and message generation. All mentionable models must have SRNs

Methods

object
save(object $obj)

Save handler, because DRY

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

boolean
restDelete(number $id)

Delete an object with rest

restCreate(array $data)

Create a new object

restUpdate(int $id, array $data)

Update an existing object

findFirstById($params = null)

No description

findFirst($params = null)

No description

find($params = null)

No description

array
parseMentions($obj, $fields, $mentioner = false)

Parses mentions for given fields. Will return an array of NEW mentions, as multiple mention records will not be created for existing mentions.

array
getMentions(string $srn)

Return all mentions for a given SRN

Details

in BaseManager at line line 23
object save(object $obj)

Save handler, because DRY

Parameters

object $obj Model to be saved

Return Value

object Model

Exceptions

Exception Json encoded string of validation errors

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);

Parameters

integer $page Current page
integer $limit Per page limit

Return Value

Paginator

in BaseManager at line line 80
boolean restDelete(number $id)

Delete an object with rest

Parameters

number $id

Return Value

boolean

Exceptions

Exception

in BaseManager at line line 103
restCreate(array $data)

Create a new object

Parameters

array $data

in BaseManager at line line 117
restUpdate(int $id, array $data)

Update an existing object

Parameters

int $id
array $data

at line line 18
findFirstById($params = null)

Parameters

$params

at line line 23
findFirst($params = null)

Parameters

$params

at line line 28
find($params = null)

Parameters

$params

at line line 45
array parseMentions($obj, $fields, $mentioner = false)

Parses mentions for given fields. Will return an array of NEW mentions, as multiple mention records will not be created for existing mentions.

You can retrieve all mentions by using the getMentions method.

Parameters

$obj
$fields
$mentioner

Return Value

array Array of new mentions

See also

MentionManager::getMentions

at line line 112
array getMentions(string $srn)

Return all mentions for a given SRN

Parameters

string $srn SRN

Return Value

array of Mention objects