\Dewdrop\Zf1Env

Zend Framework 1 environment hooks for Dewdrop.

Summary

Methods
Properties
Constants
isInUse()
getConfigData()
getBootstrapClass()
bootstrapCli()
initializeCli()
initializePimple()
providePimpleSessionResource()
getProjectNoun()
getCurrentUserId()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$dewdropOptions
$configData
N/A

Properties

$configData

$configData : array

Type

array

Methods

isInUse()

isInUse() : boolean

We assume ZF1 is in use if there is a front controller instance in place or we're on the CLI and can find the Zend_Controller_Front class.

Returns

boolean

getConfigData()

getConfigData(string  $file = null) : array

Grab configuration data from the Zend Framework application.ini. This is used to toggle the debug flag in Dewdrop's Pimple container and to provide database credentials to tools like dbdeploy.

[ 'bootstrap' => '\Your\Bootstrap\ClassName', 'db' => [ 'type' => 'pgsql|mysql', 'username' => 'user', 'password' => '123456!', 'name' => 'my_database', 'host' => 'localhost' ] ]

Parameters

string $file

Returns

array

getBootstrapClass()

getBootstrapClass() : string

Use the ZF1 bootstrap.

Returns

string

bootstrapCli()

bootstrapCli() : void

When we're starting up on the CLI, first look for Zend_Version. For it to be found, you'll either need to have loaded ZF1 via Composer or configured Composer to autoload your standalone install in composer.json. Typically, you'd do this by falling back to PSR-0 on your library folder:


"autoload": {
    "psr-0": {
        "": "src/library"
    }
}

If it's found, we configure the include path so that legacy libs like PEAR
will be auto-loaded successfully.  In addition, we configure a custom loader
for Swat, which does not follow PSR-0.

                
                
                				
                            

initializeCli()

initializeCli() : void

Assuming that we can detect ZF1 is in use after bootstrapping our CLI environment, we'll then start up the Application itself, bootstrap it, and do minimal front controller configuration. This allows us to get the configuration loaded, the application resources in place, etc. without actually starting the dispatch cycle.

initializePimple()

initializePimple(\Pimple  $pimple) : void

Override the default paths resource so that we can specify the correct location for the models folder in ZF1.

Parameters

\Pimple $pimple

providePimpleSessionResource()

providePimpleSessionResource(\Pimple  $pimple) : void

Provide the required session and session.storage resources for \Dewdrop\Session integration.

Zend_Session_Namespace, WP_Session, etc) and "session.storage" should be an implementor of \Dewdrop\Session\SessionStorageInterface that wraps that platform- specific API.

Parameters

\Pimple $pimple

getProjectNoun()

getProjectNoun() : string

Return a string that can be used to describe projects in this environment. Typically either app or plugin depending upon how Dewdrop is typically used.

Returns

string

getCurrentUserId()

getCurrentUserId() : integer|null

Get the ID for the currently logged in user or null if no user is logged in.

Returns

integer|null