Begginer doubt about component


Look at the code fragment bellow … How can I access $this->Paginator if it was not initialized within my class. If I dump the object, I can see it is a PaginatorComponent object. How cake handle that? Can someone give me an example?

class PaginasController extends AppController
public $components = array(‘Paginator’);
public $paginate = array(
‘limit’ => 5,
‘order’ => ‘Pagina.modified DESC’,
‘fields’ => array(‘’, ‘Pagina.title’, ‘Pagina.created’, ‘Pagina.modified’)

public function index() 
	$this->Paginator->settings = $this->paginate;
	$paginas = $this->Paginator->paginate();


Please have a look at the reference as everything is described there in detail.

Btw.: I’m not sure if using

public $components = […]

in a controller still works in cake3; however, I find using


much more descriptive :wink: