本文整理汇总了PHP中Phalcon\DI::getServices方法的典型用法代码示例。如果您正苦于以下问题:PHP DI::getServices方法的具体用法?PHP DI::getServices怎么用?PHP DI::getServices使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phalcon\DI
的用法示例。
在下文中一共展示了DI::getServices方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: attachServices
public function attachServices()
{
if (!$this->isEnabled()) {
return;
}
$services = array_keys($this->di->getServices());
foreach ($services as $name) {
if (stripos($name, 'cache') !== false) {
$this->attachCache($name);
}
if (stripos($name, 'db') === 0 || strtolower(substr($name, -2)) == 'db') {
$this->attachDb($name);
}
}
if ($this->di->has('view')) {
$this->attachView($this->di['view']);
}
if ($this->shouldCollect('mail', true) && $this->di->has('mailer')) {
$this->attachMailer($this->di['mailer']);
}
if ($this->shouldCollect('doctrine', false) && !$this->hasCollector('doctrine') && !$this->hasCollector('pdo')) {
$debugStack = new \Doctrine\DBAL\Logging\DebugStack();
$entityManager = $this->di['entityManager'];
$entityManager->getConnection()->getConfiguration()->setSQLLogger($debugStack);
$this->addCollector(new DoctrineCollector($debugStack));
}
}
示例2: attachServices
public function attachServices()
{
if (!$this->isEnabled()) {
return;
}
$services = array_keys($this->di->getServices());
foreach ($services as $name) {
if (stripos($name, 'cache') !== false) {
$this->attachCache($name);
}
if (stripos($name, 'db') === 0 || strtolower(substr($name, -2)) == 'db') {
$this->attachDb($name);
}
}
if ($this->di->has('view')) {
$this->attachView($this->di['view']);
}
if ($this->shouldCollect('mail', true) && $this->di->has('mailer')) {
$this->attachMailer($this->di['mailer']);
}
}