\Ceo\Core\ManagersQueueManager

QueueManager manages all CEO queues, QueueManager is managed by the service container and can be found at ``` DI::getDefault()->get('queue_manager') ```

Managers provide a service layer in front of models. Managers implement domain specific logic, checks and initialization that would normally live in multiple controllers.

Summary

Methods
Properties
Constants
save()
getPaginator()
restDelete()
restCreate()
restUpdate()
setQueues()
setConnectionFactory()
getContext()
getQueue()
publish()
No public properties found
No constants found
No protected methods found
$context
$channels
$consumer
$factory
N/A
No private methods found
No private properties found
N/A

Properties

$context

$context : 

Type

$channels

$channels : 

Type

$consumer

$consumer : 

Type

$factory

$factory : 

Type

Methods

save()

save(object  $obj) : object

Save handler, because DRY

Parameters

object $obj

Model to be saved

Throws

\Ceo\Core\Managers\Exception

Json encoded string of validation errors

Returns

object —

Model

getPaginator()

getPaginator(integer  $page = 1, integer  $limit = 50) : \Ceo\Core\Managers\Ceo\Core\ModelHelpers\Paginator

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

Returns

\Ceo\Core\Managers\Ceo\Core\ModelHelpers\Paginator

restDelete()

restDelete(\Ceo\Core\Managers\number  $id) : boolean

Delete an object with rest

Parameters

\Ceo\Core\Managers\number $id

Throws

\Exception

Returns

boolean

restCreate()

restCreate(array  $data) 

Create a new object

Parameters

array $data

restUpdate()

restUpdate(integer  $id, array  $data) 

Update an existing object

Parameters

integer $id
array $data

setQueues()

setQueues(array  $queues) 

Establish queues, queues are defined as reference => queuename The reference is used to alias a queue to a easier name, eg: ``` [ 'socket' => 'ceo_socket_queue', 'worker' => 'ceo_worker_queue' ] ``` Then you can simply refer to 'socket' or 'worker' queues.

Parameters

array $queues

setConnectionFactory()

setConnectionFactory(object  $factory) : self

Set the connection factory for this queue. QueueManager is is transport agnostic see below for transport options.

Parameters

object $factory

Returns

self

getContext()

getContext() : object

Get the current transport context

Returns

object

getQueue()

getQueue(string  $queue) : object

Get a defined queue

Parameters

string $queue

Returns

object

publish()

publish(string  $data, string  $queue = 'worker') 

Push data into the work queue

Parameters

string $data
string $queue

Queue Context