Dutch PHP Conference 2027

Yaf_Action_Abstract::getController

(Yaf >=1.0.0)

Yaf_Action_Abstract::getControllerRetrieve controller object

Açıklama

publicfunction Yaf_Action_Abstract::getController(): ?Yaf_Controller_Abstract

Retrieves the controller that owns this action.

Bağımsız Değişkenler

Bu işlevin bağımsız değişkeni yoktur.

Dönen Değerler

A Yaf_Controller_Abstract instance, or null if no controller is available.

Örnekler

Örnek 1 Yaf_Action_Abstract::getController() example

<?php
class ListAction extends Yaf_Action_Abstract
{
    public function execute() {
        // the controller that owns this action
        $controller = $this->getController();
        var_dump($controller instanceof Yaf_Controller_Abstract);

        // e.g. to reach its view engine
        $controller->getView()->assign("products", array("yaf", "php"));
    }
}
?>

Yukarıdaki örnek şuna benzer bir çıktı üretir:

bool(true)

Ayrıca Bakınız

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top