Table Of Contents

Previous topic

< Class Phalcon\CLI\Router\Exception

Next topic

Class Phalcon\Cache\Backend >

This Page

Class Phalcon\CLI\Task

extends Phalcon\DI\Injectable

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

Every command-line task should extend this class that encapsulates all the task functionality A task can be used to run “tasks” such as migrations, cronjobs, unit-tests, or anything that you want. The Task class should at least have a “mainAction” method

<?php

class HelloTask extends \Phalcon\CLI\Task
{

  //This action will be executed by default
  public function mainAction()
  {

  }

  public function findAction()
  {

  }

}

Methods

final public __construct ()

Phalcon\CLI\Task constructor

public setDI (Phalcon\DiInterface $dependencyInjector) inherited from Phalcon\DI\Injectable

Sets the dependency injector

public Phalcon\DiInterface getDI () inherited from Phalcon\DI\Injectable

Returns the internal dependency injector

public setEventsManager (Phalcon\Events\ManagerInterface $eventsManager) inherited from Phalcon\DI\Injectable

Sets the event manager

public Phalcon\Events\ManagerInterface getEventsManager () inherited from Phalcon\DI\Injectable

Returns the internal event manager

public __get (string $propertyName) inherited from Phalcon\DI\Injectable

Magic method __get