In listing 10.1 we specified that the configuration section to use is 'nick-dev' by passing it as a parameter
to the Bootstrap constructor before the call to run. Listing 10.2 shows a stripped down version of bootstrap.php
to highlight how the deployment environment is set and used when calling the configuration settings.
Listing 10.2 A stripped down version of the Bootstrap class in bootstrap.php
class Bootstrap
{
protected $_deploymentEnvironment;
public function __construct($deploymentEnvironment) A
{
$this->_deploymentEnvironment = $deploymentEnvironment;
}
public function run() B
{
$config = new Zend_Config_Ini(
'configuration/config.ini',
$this->_deploymentEnvironment); C
A The environment parameter which we had set as being ???nick-dev??? in our index.php file
B The run() method which initialises and starts our application
C Zend_Config_Ini is sent the section 'nick-dev' as its second parameter
The second parameter passed to Zend_Config_Ini in listing 10.2 specifies that the section to be read from
our config.ini file is the one passed from index.php, i.e. 'nick-dev'. Zend_Config_Ini not only supports ini
sections but also implements inheritance from one section to another. An inheriting sections can also override
values inherited from its parents.
Pages:
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279