Predefined Constants

The constants below are defined by this extension, and will only be available when the extension has either been compiled into PHP or dynamically loaded at runtime.

When an error occurs during startup, routing, dispatching or autoloading, Yaf either throws a subclass of Yaf_Exception whose exception code is one of the YAF_ERR_* constants, or triggers a PHP error of the corresponding type — see Yaf_Dispatcher::throwException() and Yaf_Application::getLastErrorNo().

YAF_VERSION (string)

The version of the loaded Yaf extension, e.g. "3.3.8".

YAF_ENVIRON (string)

The value of the yaf.environ directive at the time the extension was started, used by Yaf_Application to select the configuration section. Defaults to "product".

YAF_ERR_STARTUP_FAILED (int)

Startup failure, value 512. Thrown as a Yaf_Exception_StartupError when Yaf_Application could not be started, e.g. the application directory is missing or the configuration is invalid.

YAF_ERR_ROUTE_FAILED (int)

Routing failure, value 513. Thrown as a Yaf_Exception_RouterFailed when no route was able to route the request.

YAF_ERR_DISPATCH_FAILED (int)

Dispatch failure, value 514. Thrown as a Yaf_Exception_DispatchFailed when the request could not be dispatched, e.g. when the yaf.forward_limit is exceeded.

YAF_ERR_NOTFOUND_MODULE (int)

The module could not be found, value 515. Thrown as a Yaf_Exception_LoadFailed_Module.

YAF_ERR_NOTFOUND_CONTROLLER (int)

The controller could not be found, value 516. Thrown as a Yaf_Exception_LoadFailed_Controller.

YAF_ERR_NOTFOUND_ACTION (int)

The action could not be found, value 517. Thrown as a Yaf_Exception_LoadFailed_Action.

YAF_ERR_NOTFOUND_VIEW (int)

The view script could not be found, value 518. Thrown as a Yaf_Exception_LoadFailed_View.

YAF_ERR_CALL_FAILED (int)

Calling a method failed, value 519. Used when an action method or another callable could not be invoked.

YAF_ERR_AUTOLOAD_FAILED (int)

Autoloading failed, value 520. Triggered by Yaf_Loader when the file for a class cannot be loaded, e.g. the resolved path is too long.

YAF_ERR_TYPE_ERROR (int)

A type error occurred, value 521. Thrown as a Yaf_Exception_TypeError when an argument or a class definition has an unexpected type, e.g. a controller that is not a class extending Yaf_Controller_Abstract.

YAF_ERR_ACCESS_ERROR (int)

Access is not allowed, value 522. Used, for example, when attempting to call an action method that is not public.

(Available since Yaf 3.2.0.)

add a note

User Contributed Notes 1 note

up
1
lee dot howarth dot 90 at gmail dot com
12 years ago
The documentation here is not fully correct.

<?php

    print_r(get_defined_constants());
   die;

?>

Will show basically:

  [PHP_YAF_VERSION] => 2.3.2
    [YAF_ENVIRON] => product
    [YAF_ERR_STARTUP_FAILED] => 512
    [YAF_ERR_ROUTE_FAILED] => 513
    [YAF_ERR_DISPATCH_FAILED] => 514
    [YAF_ERR_AUTOLOAD_FAILED] => 520
    [YAF_ERR_NOTFOUND_MODULE] => 515
    [YAF_ERR_NOTFOUND_CONTROLLER] => 516
    [YAF_ERR_NOTFOUND_ACTION] => 517
    [YAF_ERR_NOTFOUND_VIEW] => 518
    [YAF_ERR_CALL_FAILED] => 519
    [YAF_ERR_TYPE_ERROR] => 521

So use PHP_YAF_VERSION instead of just YAF_VERSION