protected function __resolve_new($value = null, $as = null) { $auto = $this->autoNamespace($as, 'Collection'); $class = $this->popClass($value) ?: (class_exists($auto) ? $auto : get_class($this->use)); if (is_a($class, self::class, true)) { if ($as and 0 !== strpos($as, '.')) { $name = $this->name ? $this->name . '.' : ''; $value += ['name' => $name . $as]; } $value += ['db' => $this->{'$db'}]; } $value['class'] = '\\' . $class; return parent::__resolve_new($value, $as); }
protected function __resolve_new($value = null, $as = null) { $auto = $this->autoNamespace($as); if (!class_exists($auto)) { $auto = $this->use->normalizeClass('Controller'); } $class = $this->popClass($value) ?: (class_exists($auto) ? $auto : self::class); if (is_a($class, self::class, true)) { if ($as and 0 !== strpos($as, '.')) { $value['path'] = $this->path . str_replace('.', '/', $as) . '/'; } $value += ['template' => $this->{'$template'}, 'request' => $this->{'$request'}, 'session' => $this->{'$session'}, 'db' => $this->{'$db'}]; } $value['class'] = '\\' . $class; return parent::__resolve_new($value, $as); }