isCreated() public method

Is the service created?
public isCreated ( $name ) : boolean
return boolean
Example #1
0
 public function flush()
 {
     $mappers = [];
     foreach ($this->repositories['names'] as $name) {
         if ($this->container->isCreated($name)) {
             $mappers[] = $this->container->getService($name)->getMapper();
         }
     }
     foreach ($mappers as $mapper) {
         $mapper->flush();
     }
 }
Example #2
0
 private function renderListeners($ids)
 {
     static $addIcon;
     if (empty($addIcon)) {
         $addIcon = '<img width="18" height="18" src="data:image/png;base64,' . base64_encode(file_get_contents(__DIR__ . '/add.png')) . '" title="Listener" />';
     }
     $registeredClasses = $this->getClassMap();
     $h = 'htmlspecialchars';
     $shortFilename = function (Nette\Reflection\GlobalFunction $refl) {
         $title = '.../' . basename($refl->getFileName()) . ':' . $refl->getStartLine();
         if ($editor = Tracy\Helpers::editorUri($refl->getFileName(), $refl->getStartLine())) {
             return sprintf(' defined at <a href="%s">%s</a>', htmlspecialchars($editor), $title);
         }
         return ' defined at ' . $title;
     };
     $s = '';
     foreach ($ids as $id) {
         if (is_callable($id)) {
             $s .= '<tr><td width=18>' . $addIcon . '</td><td><pre class="nette-dump"><span class="nette-dump-object">' . Callback::toString($id) . ($id instanceof \Closure ? $shortFilename(Callback::toReflection($id)) : '') . '</span></span></th></tr>';
             continue;
         }
         if (!$this->sl->isCreated($id) && ($class = array_search($id, $registeredClasses, TRUE))) {
             $s .= '<tr><td width=18>' . $addIcon . '</td><td><pre class="nette-dump"><span class="nette-dump-object">' . $h(Nette\Reflection\ClassType::from($class)->getName()) . '</span></span></th></tr>';
         } else {
             try {
                 $s .= '<tr><td width=18>' . $addIcon . '</td><td>' . self::dumpToHtml($this->sl->getService($id)) . '</th></tr>';
             } catch (\Exception $e) {
                 $s .= "<tr><td colspan=2>Service {$id} cannot be loaded because of exception<br><br>\n" . (string) $e . '</td></th>';
             }
         }
     }
     return $s;
 }
Example #3
0
 public function isCreated($className)
 {
     return $this->container->isCreated($this->repositoryNamesMap[$className]);
 }