php8.5
Home/ Manual/ yaf / yaf_action_abstract/ Yaf_Action_Abstract::getControllerName

Yaf_Action_Abstract::getControllerName

PHP function Edit on GitHub ✎

(Yaf >=3.3.7)

Get controller name

Description

Yaf_Action_Abstract::getControllerName(): string|null

Returns the name of the controller that owns this action.

Parameters Parameters

Return Values

The controller name as a String, or null if it is not set.

Examples

Yaf_Action_Abstract::getControllerName example

php
<?php
class ListAction extends Yaf_Action_Abstract
{
    public function execute() {
        // the name of the controller that owns this action,
        // e.g. "Product" for a ProductController
        var_dump($this->getControllerName());
    }
}
?>

The above example will output something similar to:

output
string(7) "Product"

See Also

  • Yaf_Action_Abstract::getController
  • Yaf_Controller_Abstract::getName

Source: reference/yaf/yaf_action_abstract/getcontrollername.xml · from the official PHP manual (php/doc-en)