NerdsAndCompany\Schematic\Console\App::getComponent PHP 메소드

getComponent() 공개 메소드

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
리턴 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;
    }