Documentation

目次

前のトピックへ

< Class Phalcon\Assets\Resource\Js

次のトピックへ

Class Phalcon\CLI\Console\Exception >

このページ

Class Phalcon\CLI\Console

implements Phalcon\DI\InjectionAwareInterface, Phalcon\Events\EventsAwareInterface

This component allows to create CLI applications using Phalcon

Methods

public __construct ([unknown $dependencyInjector])

Phalcon\CLI\Console constructor

public setDI (Phalcon\DiInterface $dependencyInjector)

Sets the DependencyInjector container

public Phalcon\DiInterface getDI ()

Returns the internal dependency injector

public setEventsManager (Phalcon\Events\ManagerInterface $eventsManager)

Sets the events manager

public Phalcon\Events\ManagerInterface getEventsManager ()

Returns the internal event manager

public registerModules (array $modules)

Register an array of modules present in the console

<?php

$application->registerModules(array(
    'frontend' => array(
            'className' => 'Multiple\Frontend\Module',
            'path' => '../apps/frontend/Module.php'
    ),
    'backend' => array(
            'className' => 'Multiple\Backend\Module',
            'path' => '../apps/backend/Module.php'
    )
));

public addModules (array $modules)

Merge modules with the existing ones

<?php

$application->addModules(array(
    'admin' => array(
            'className' => 'Multiple\Admin\Module',
            'path' => '../apps/admin/Module.php'
    )
));

public array getModules ()

Return the modules registered in the console

public mixed handle ([array $arguments])

Handle the command-line arguments.

<?php

    $arguments = array(
            'task' => 'taskname',
            'action' => 'action',
            'params' => array('parameter1', 'parameter2')
    );
    $console->handle($arguments);