Table Of Contents

Previous topic

< Class Phalcon\Mvc\Micro

Next topic

Class Phalcon\Mvc\Micro\Exception >

This Page

Class Phalcon\Mvc\Micro\Collection

implements Phalcon\Mvc\Micro\CollectionInterface

Groups Micro-Mvc handlers as controllers

<?php

 $app = new Phalcon\Mvc\Micro();

 $collection = new Phalcon\Mvc\Micro\Collection();

 $collection->setHandler(new PostsController());

 $collection->get('/posts/edit/{id}', 'edit');

 $app->mount($collection);

Methods

protected _addMap ()

Internal function to add a handler to the group

public Phalcon\Mvc\Micro\Collection setPrefix (string $prefix)

Sets a prefix for all routes added to the collection

public string getPrefix ()

Returns the collection prefix if any

public array getHandlers ()

Returns the registered handlers

public Phalcon\Mvc\Micro\Collection setHandler (mixed $handler, [boolean $lazy])

Sets the main handler

public Phalcon\Mvc\Micro\Collection setLazy (boolean $lazy)

Sets if the main handler must be lazy loaded

public boolean isLazy ()

Returns if the main handler must be lazy loaded

public mixed getHandler ()

Returns the main handler

public Phalcon\Mvc\Router\RouteInterface map (string $routePattern, callable $handler)

Maps a route to a handler

public Phalcon\Mvc\Router\RouteInterface get (string $routePattern, callable $handler)

Maps a route to a handler that only matches if the HTTP method is GET

public Phalcon\Mvc\Router\RouteInterface post (string $routePattern, callable $handler)

Maps a route to a handler that only matches if the HTTP method is POST

public Phalcon\Mvc\Router\RouteInterface put (string $routePattern, callable $handler)

Maps a route to a handler that only matches if the HTTP method is PUT

public Phalcon\Mvc\Router\RouteInterface patch (string $routePattern, callable $handler)

Maps a route to a handler that only matches if the HTTP method is PATCH

public Phalcon\Mvc\Router\RouteInterface head (string $routePattern, callable $handler)

Maps a route to a handler that only matches if the HTTP method is HEAD

public Phalcon\Mvc\Router\RouteInterface delete (string $routePattern, callable $handler)

Maps a route to a handler that only matches if the HTTP method is DELETE

public Phalcon\Mvc\Router\RouteInterface options (string $routePattern, callable $handler)

Maps a route to a handler that only matches if the HTTP method is OPTIONS