$behavior->$name = $value; return; } } if (method_exists($this, 'get' . $name)) { throw new InvalidCallException('Setting read-only property: ' . get_class($this) . '::' . $name); } throw new UnknownPropertyException('Setting unknown property: ' . get_class($this) . '::' . $name); } /** * Checks if a property is set, i.e. defined and not null. * * This method will check in the following order and act accordingly: * * - a property defined by a setter: return whether the property is set * - a property of a behavior: return whether the property is set
* @param array $properties the property initial values given in terms of name-value pairs. * @return object the object itself */ public static function configure($object, $properties) { foreach ($properties as $name => $value) { $object->$name = $value; } return $object; } /**
* * @param array $config name-value pairs that will be used to initialize the object properties */ public function __construct($config = []) { if (!empty($config)) { Yii::configure($this, $config); } $this->init(); } /** * Initializes the object.
* @param array $config name-value pairs that will be used to initialize the object properties */ public function __construct($id, $controller, $config = []) { $this->id = $id; $this->controller = $controller; parent::__construct($config); } /** * Returns the unique ID of this action among the whole application. * * @return string the unique ID of this action among the whole application.
$config = $this->resolveDependencies($config); if (!empty($dependencies) && $reflection->implementsInterface('yii\base\Configurable')) { // set $config as the last parameter (existing one will be overwritten) $dependencies[count($dependencies) - 1] = $config; return $reflection->newInstanceArgs($dependencies); } $object = $reflection->newInstanceArgs($dependencies); foreach ($config as $name => $value) { $object->$name = $value; }
$class = $class->id; } if (isset($this->_singletons[$class])) { // singleton return $this->_singletons[$class]; } elseif (!isset($this->_definitions[$class])) { return $this->build($class, $params, $config); } $definition = $this->_definitions[$class]; if (is_callable($definition, true)) { $params = $this->resolveDependencies($this->mergeParams($class, $params));
* @throws NotInstantiableException * @throws \yii\base\InvalidConfigException */ public function get($class, $params = [], $config = []) { $this->mergeDefinitionsExt($class, $class); return $object = parent::get($class, $params, $config); } }
return static::$container->get($class, $params, $type); } if (isset($type['class'])) { $class = $type['class']; unset($type['class']); return static::$container->get($class, $params, $type); } throw new InvalidConfigException('Object configuration must be an array containing a "class" or "__class" element.'); } private static $_logger;
try { return parent::createObject($type, $params); } catch (Exception $e) { } } elseif (is_array($type) && isset($type['class'])) { return parent::createObject($type, $params); } if (is_string($type)) { return static::$table->get($type); } elseif (is_array($type) && isset($type['tableName'])) { return static::$table->get($type); }
if ($id === '') { $id = $this->defaultAction; } $actionMap = $this->actions(); if (isset($actionMap[$id])) { return Yii::createObject($actionMap[$id], [$id, $this]); } if (preg_match('/^(?:[a-z0-9_]+-)*[a-z0-9_]+$/', $id)) { $methodName = 'action' . str_replace(' ', '', ucwords(str_replace('-', ' ', $id))); if (method_exists($this, $methodName)) { $method = new \ReflectionMethod($this, $methodName);
* @return mixed the result of the action. * @throws InvalidRouteException if the requested action ID cannot be resolved into an action successfully. * @see createAction() */ public function runAction($id, $params = []) { $action = $this->createAction($id); if ($action === null) { throw new InvalidRouteException('Unable to resolve the request: ' . $this->getUniqueId() . '/' . $id); } Yii::debug('Route to run: ' . $action->getUniqueId(), __METHOD__);
$parts = $this->createController($route); if (is_array($parts)) { /* @var $controller Controller */ list($controller, $actionID) = $parts; $oldController = Yii::$app->controller; Yii::$app->controller = $controller; $result = $controller->runAction($actionID, $params); if ($oldController !== null) { Yii::$app->controller = $oldController; } return $result; }
$params = $this->catchAll; unset($params[0]); } try { Yii::debug("Route requested: '$route'", __METHOD__); $this->requestedRoute = $route; $result = $this->runAction($route, $params); if ($result instanceof Response) { return $result; } $response = $this->getResponse(); if ($result !== null) {
{ try { $this->state = self::STATE_BEFORE_REQUEST; $this->trigger(self::EVENT_BEFORE_REQUEST); $this->state = self::STATE_HANDLING_REQUEST; $response = $this->handleRequest($this->getRequest()); $this->state = self::STATE_AFTER_REQUEST; $this->trigger(self::EVENT_AFTER_REQUEST); $this->state = self::STATE_SENDING_RESPONSE; $response->send();
$modulesConfig = Yii::createObject(\tdsgn\configuration\common\components\ConfigComponent::class)->execute('api'); $config = \yii\helpers\ArrayHelper::merge($modulesConfig, $config); $config = \tdsgn\user\ConfigModule::configRemove($config); $application = new \tdsgn\common\Application($config); $application->run();
$_GET = [ '__modelName' => 'projects', 'categorySlug' => 'vtoraa-klassnaa-kategoria', ];