NerdsAndCompany\Schematic\Console\App::getComponent PHP Méthode

getComponent() public méthode

Override getComponent() so we can attach any pending events if the component is getting initialized as well as do some special logic around creating the Craft::app()->db application component.
public getComponent ( string $id, boolean $createIfNull = true ) : mixed
$id string
$createIfNull boolean
Résultat mixed
    public function getComponent($id, $createIfNull = true)
    {
        $component = parent::getComponent($id, false);
        if (!$component && $createIfNull) {
            if ($id === 'db') {
                $dbConnection = $this->asa('SchematicBehavior')->createDbConnection();
                $this->setComponent('db', $dbConnection);
            }
            $component = parent::getComponent($id, true);
            $this->_attachEventListeners($id);
        }
        return $component;
    }