Created
August 5, 2011 15:14
-
-
Save weaverryan/1127748 to your computer and use it in GitHub Desktop.
Example "Container" in symfony 1.4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class mySoapActions extends sfActions | |
{ | |
public function executeSomething(sfWebRequest $request) | |
{ | |
$soapApi = $this->getSoapAPI(); | |
// do something with it | |
} | |
/** | |
* @return mtReportSoapApi | |
*/ | |
private function getSoapAPI() | |
{ | |
return $this->getContext() | |
->getConfiguration() | |
->getPluginConfiguration('mtReportPlugin') | |
->getSoapApi() | |
; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// plugins/mtReportPlugin/config/mtReportPluginConfiguration.class.php | |
class mtReportPluginConfiguration extends sfPluginConfiguration | |
{ | |
protected $mtSoapApi; | |
public function getSoapApi() | |
{ | |
if ($this->mtSoapApi === null) | |
{ | |
// in theory, the creation of this would also be centralized, but whatever | |
$reportingObject = new reportGuidePageOrders(); | |
$this->mtSoapApi = new mtReportSoapApi('some_config', 'other_config', $reportingObject); | |
} | |
return $this->mtSoapApi; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment