PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Registry

Because providers and manifests may come from anywhere in the include_path, a registry is provided to simplify access to the various pieces of the toolchain. This registry is injected into registry-aware components, which may then pull dependencies from them as necessary. Most dependencies registered with the registry will be sub-component-specific repositories.

The interface for the registry consists of the following definition:

<?php
interface Zend_Tool_Framework_Registry_Interface
{
    public function 
setClient(Zend_Tool_Framework_Client_Abstract $client);
    public function 
getClient();
    public function 
setLoader(Zend_Tool_Framework_Loader_Abstract $loader);
    public function 
getLoader();
    public function 
setActionRepository(
        
Zend_Tool_Framework_Action_Repository $actionRepository
    
);
    public function 
getActionRepository();
    public function 
setProviderRepository(
        
Zend_Tool_Framework_Provider_Repository $providerRepository
    
);
    public function 
getProviderRepository();
    public function 
setManifestRepository(
        
Zend_Tool_Framework_Manifest_Repository $manifestRepository
    
);
    public function 
getManifestRepository();
    public function 
setRequest(Zend_Tool_Framework_Client_Request $request);
    public function 
getRequest();
    public function 
setResponse(Zend_Tool_Framework_Client_Response $response);
    public function 
getResponse();
}

The various objects the registry manages will be discussed in their appropriate sections.

Classes that should be registry-aware should implement Zend_Tool_Framework_Registry_EnabledInterface. This interface merely allows initialization of the registry in the target class.

<?php
interface Zend_Tool_Framework_Registry_EnabledInterface
{
    public function 
setRegistry(
        
Zend_Tool_Framework_Registry_Interface $registry
    
);
}

Zend Framework