Giter Club home page Giter Club logo

demo's Introduction

Yii 3 Demo Code

This repository contains the code for the Yii 3 demo projects: https://demo.yiiframework.com

Deployment

Manually Renew SSL Cert

docker-compose run certbot
docker-compose restart gateway

demo's People

Contributors

1luc1 avatar arhell avatar arogachev avatar damasco avatar darkdef avatar devanych avatar fantom409 avatar githubjeka avatar hiqsol avatar iamsaint avatar luizcmarin avatar maximal avatar mister-42 avatar nex-otaku avatar pacodes avatar pamparam83 avatar razonyang avatar romkatsu avatar rossaddison avatar roxblnfk avatar rustamwin avatar samdark avatar sankaest avatar stylecibot avatar terabytesoftw avatar thenotsoft avatar viktorprogger avatar vjik avatar xepozz avatar yiiliveext avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

demo's Issues

composer install error

Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 120 installs, 0 updates, 0 removals

  • Installing foxy/foxy (v1.1.0): Loading from cache
    Plugin installation failed (No asset manager is found), rolling back
  • Removing foxy/foxy (v1.1.0)

[Foxy\Exception\RuntimeException]
No asset manager is found

AccessChecker is session dependent

What steps will reproduce the problem?

AccessChecker is session dependent

What is the expected result?

What do you get instead?

Additional info

Q A
Version 1.0.?
PHP version 7.4
Operating system Docker

yii serve gives error if debug is disabled

What steps will reproduce the problem?

  1. Remove 'debugger.enabled' => true, from params.php
  2. When I run the command 'yii serve', I get the following error

What is the expected result?

What do you get instead?

yiierror

Additional info

Q A
Version 1.0.?
PHP version
Operating system

Transfer base controller to the yii-web package

I am sure that many users do not need to configure the controller for themselves at all.

And those who need it will be able to inherit the basic controller and supplement it, or create their own.

Also since the class is abstract, please rename it AbstractController

Minor issue: InvalidArgumentException - Invalid path alias @web

What steps will reproduce the problem?

Exclude '@web'=>'@root/public', from

    'aliases' => [
            '@root' => dirname(__DIR__),
            '@views' => '@root/views',
            '@resources' => '@root/resources',
            '@src' => '@root/src',
           //'@web'=>'@root/public',
    ],

situated in file: ..config/params.php

What is the expected result?

Clean boot

What do you get instead?

Above error.

Additional info

Q A
Version 3
PHP version 7.49
Operating system Windows 10

where is the ORMInterface $orm in BlogController come from

I just begin to read the demo code , for select a better framework.
run the code work well, show the result ok.

http://127.0.0.1:8080/blog

Tracing code at src/Blog/BlogController

    public function index(Request $request, ORMInterface $orm, ArchiveRepository $archiveRepo): Response
    {
var_dump(get_class($orm)); // => Cycle\ORM\ORM
        /** @var PostRepository $postRepo */
        $postRepo = $orm->getRepository(Post::class);
debug_print_backtrace(2); 
       //...
    }

what the $orm come from ? can I have other way to get it.
like $orm = App::GetOrm();
and where the code is $orm object init ?

i want to that what my object is decleare explict.

What steps will reproduce the problem?

What is the expected result?

What do you get instead?

Additional info

Q A
Version 1.0.?
PHP version 7.4.4
Operating system wsl1-debian

Не работает демо

в пакете yiisoft/composer-config-plugin-output в файле web.php переменная
$baseDir = dirname(__DIR__, 3);
перезаписывается из dotenv.php на
$baseDir = __DIR__;
итого, установленное приложение ищет папки не из корня приложения, а с корень-приложения/runtime/build/config

$currentUrl is never set

What steps will reproduce the problem?

Using $currentUrl in layout as indicated in main here.

What is the expected result?

The current URL.
Although I think $currentRoute would be more useful.

What do you get instead?

The value is always NULL.

Additional info

Q A
Version current dev
PHP version 7.4.6
Operating system Debian 9

composer update error

hi.
The following error is displayed when composer update:

[hiqdev\composer\config\exceptions\FailedReadException] failed read file: /app/vendor/yiisoft/view/config/common.php

Additional info

Q A
Version yii3, master branch
PHP version 7.4
Operating system linux, ubuntu 18.04

Create interfaces for repositories

I think it is good practice to use interfaces for repositories.

Repository methods already return DataReaderInterface objects (this gives us independence from DBAL), it remains only to describe their API in the interfaces.

Where is Models?

Hi

In the current structure, the models have been removed and replaced by repositories.

I think models should exist and do functional actions on repositories.

In this method, the Repository contain basic functions (such as finaAll , findOne, etc.) and the Model have the controller required functions.

Repository Example:

class UserRepository extends ...
{
    public function findAll(array $scope = [], array $orderBy = []): DataReaderInterface
    {
        return new SelectDataReader($this->select()->where($scope)->orderBy($orderBy));
    }

    private function findIdentityBy(string $field, string $value): ?IdentityInterface
    {
        return $this->findOne([$field => $value]);
    }

    public function findIdentity(string $id): ?IdentityInterface
    {
        return $this->findByPK($id);
    }

    public function findIdentityByToken(string $token, string $type = null): ?IdentityInterface
    {
        return $this->findIdentityBy('token', $token);
    }

    public function findByLogin(string $login): ?IdentityInterface
    {
        return $this->findIdentityBy('login', $login);
    }
}

Model Example:

class User extends Model
{
    public function search(array $params = [],UserRepository $userRepository)
    {
        $dataReader = $userRepository->findAll()->withSort((new Sort([]))->withOrderString('login'));
        $paginator = (new OffsetPaginator($dataReader))
            ->withPageSize(self::PAGINATION_INDEX)
            ->withCurrentPage($pageNum);

        return $paginator;
    }
    

    public function signup(...)
    {
        //validate 
        //create user record
        //create user profile
        
    }

    public function ActiveUser(...)
    {
            
    }
}

The console application does not work along the path ./vendor/bin/yii

What steps will reproduce the problem?

The console application does not work along the path ./vendor/bin/yii

What is the expected result?

The console application php vendor/yiisoft/yii-console/bin/yii

What do you get instead?

/usr/bin/env: 'php\r': No such file or directory

Additional info

Q A
Version 1.0.?
PHP version 7.4
Operating system
Windows yiisoftware/yii-php:7.4-apache Docker conteiner

poor AB bench results

Hi,

not sure where to ask - so just shortly here:

I did apache bench on yii3 (demo) against yii2 (basic app) and got extremly poor results for yii3:

  • yii3 - only about 0.18 page per sec, 1 request takes about 5-6 secs
  • yii2 - OK, about 140 pages per sec

Using latest version of yii3 dev (composer update), PHP 7.4.1.

bench results here (must have switched to -n 1 due to extremly slow response):

Yii3


d:\wamp\bin\apache\apache2.4.37\bin>ab -n 1 -c 1 127.0.0.1/yii3/yii-demo/public/index.php
This is ApacheBench, Version 2.3 <$Revision: 1843412 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient).....done


Server Software:        Apache/2.4.37
Server Hostname:        127.0.0.1
Server Port:            80

Document Path:          /yii3/yii-demo/public/index.php
Document Length:        43 bytes

Concurrency Level:      1
Time taken for tests:   5.987 seconds
Complete requests:      1
Failed requests:        0
Non-2xx responses:      1
Total transferred:      344 bytes
HTML transferred:       43 bytes
Requests per second:    0.18 [#/sec] (mean)                    <- why? edit: found reason: 404 timeout
Time per request:       5986.504 [ms] (mean)
Time per request:       5986.504 [ms] (mean, across all concurrent requests)
Transfer rate:          0.06 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       0
Processing:  5987 5987   0.0   5987    5987
Waiting:      687  687   0.0    687     687
Total:       5987 5987   0.0   5987    5987

Is there anything special to configure for yii3 demo CLI environment .. ?
In HTTP mode yii3 demo works all OK.


As for yii2 results are OK on the same setup:

Yii2

d:\wamp\bin\apache\apache2.4.37\bin>ab -n 1000 -c 1 127.0.0.1/yii2/basic/web/index.php
This is ApacheBench, Version 2.3 <$Revision: 1843412 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests


Server Software:        Apache/2.4.37
Server Hostname:        127.0.0.1
Server Port:            80

Document Path:          /yii2/basic/web/index.php
Document Length:        65901 bytes

Concurrency Level:      1
Time taken for tests:   6.571 seconds
Complete requests:      1000
Failed requests:        0
Non-2xx responses:      1000
Total transferred:      66116000 bytes
HTML transferred:       65901000 bytes
Requests per second:    152.20 [#/sec] (mean)
Time per request:       6.571 [ms] (mean)
Time per request:       6.571 [ms] (mean, across all concurrent requests)
Transfer rate:          9826.70 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   1.3      0      10
Processing:     0    6   4.7      9      16
Waiting:        0    6   4.7      7      16
Total:          0    6   4.8     10      16

Percentage of the requests served within a certain time (ms)
  50%     10
  66%     10
  75%     10
  80%     10
  90%     10
  95%     13
  98%     15
  99%     15
 100%     16 (longest request)

How to setup CORS in yii3 ?

What steps will reproduce the problem?

i have done to setup on web server in this case i use apache2

What is the expected result?

my API can run on another domain

Additional info

Q A
Version 1.0.?
PHP version 7.4.7
Operating system Ubuntu 18.04

Getting DI Container

Is there a way to get the DI container from dependency injection without initializing it from the constructor? What I mean is like Laravel which has a resolve function to get container without initializing it from the constructor.

Additional info

Q A
Version 1.0.?
PHP version 7.4
Operating system Windows 10

Best way to load params, proposal.

Controler.php

abstract class Controller implements ViewContextInterface
{
    private $params;

    public function __construct()
    {
        $this->params = require dirname(__DIR__, 1) . '/config/params.php';
    }

    private function renderContent($content): string
    {
        $layout = $this->findLayoutFile($this->layout);
        if ($layout !== null) {
            return $this->view->renderFile($layout, ['content' => $content, 'params' => $this->params], $this);
        }

        return $content;
    }
}

What do you think, so it would be available for layouts and views, you could even use hiqdev-composer-plug-in to load all the params of the installed applications ?

Q A
Version 3.0
PHP version 7.3.23
Operating system Windows10

No definition for Psr\Log\LoggerInterface

After installing the project in dev mode and running web server:

composer create-project --stability=dev --prefer-dist yiisoft/yii-demo myapp
cd myapp/public
php -S 0.0.0.0:8080

I got an exception:

Uncaught Yiisoft\Factory\Exceptions\NotFoundException: No definition for Psr\Log\LoggerInterface in /home/maximal/project/myapp/vendor/yiisoft/di/src/Container.php:134
Stack trace:
#0 /home/maximal/project/myapp/vendor/yiisoft/di/src/Container.php(120): Yiisoft\Di\Container->buildPrimitive('Psr\\Log\\LoggerI...', Array)
#1 /home/maximal/project/myapp/vendor/yiisoft/di/src/Container.php(111): Yiisoft\Di\Container->buildInternal('Psr\\Log\\LoggerI...', Array)
#2 /home/maximal/project/myapp/vendor/yiisoft/di/src/Container.php(79): Yiisoft\Di\Container->build('Psr\\Log\\LoggerI...', Array)
#3 /home/maximal/project/myapp/vendor/yiisoft/factory/src/Definitions/ClassDefinition.php(31): Yiisoft\Di\Container->get('Psr\\Log\\LoggerI...')
#4 /home/maximal/project/myapp/vendor/yiisoft/factory/src/Definitions/ArrayBuilder.php(63): Yiisoft\Factory\Definitions\ClassDefinition->resolve(Object(Yiisoft\Di\Container))
#5 /home/maximal/project/myapp/vendor/yiisoft/factory/src/Definitions/ArrayBuilder.php(47): Yiisoft\Factory\Def in /home/maximal/project/myapp/vendor/yiisoft/di/src/Container.php on line 134

Tried to dig into Container and ArrayBuilder classes but nothing worked out.

How can I run demo web app?

/vendor/bin/yii serve error

What steps will reproduce the problem?

Steps from the guide (https://github.com/yiisoft/docs/blob/master/guide/en/start/installation.md):

composer create-project --prefer-dist --stability=dev yiisoft/yii-demo yii3-app
cd yii3-app/public
../vendor/bin/yii serve

What is the expected result?

Web server started

What do you get instead?

PHP Fatal error:  Uncaught ReflectionException: Class commands does not exist in /vagrant/yii3-app/vendor/yiisoft/factory/src/Resolvers/ClassNameResolver.php:22
Stack trace:
#0 /vagrant/yii3-app/vendor/yiisoft/factory/src/Resolvers/ClassNameResolver.php(22): ReflectionClass->__construct('commands')
#1 /vagrant/yii3-app/vendor/yiisoft/factory/src/Definitions/ArrayBuilder.php(78): Yiisoft\Factory\Resolvers\ClassNameResolver->resolveConstructor('commands')
#2 /vagrant/yii3-app/vendor/yiisoft/factory/src/Definitions/ArrayBuilder.php(18): Yiisoft\Factory\Definitions\ArrayBuilder->getDependencies('commands')
#3 /vagrant/yii3-app/vendor/yiisoft/factory/src/Definitions/ArrayDefinition.php(74): Yiisoft\Factory\Definitions\ArrayBuilder->build(Object(Yiisoft\Di\Container), Object(Yiisoft\Factory\Definitions\ArrayDefinition))
#4 /vagrant/yii3-app/vendor/yiisoft/di/src/Container.php(123): Yiisoft\Factory\Definitions\ArrayDefinition->resolve(Object(Yiisoft\Di\Container), Array)
#5 /vagrant/yii3-app/vendor/yiisoft/di/src/Container.php(111):  in /vagrant/yii3-app/vendor/yiisoft/factory/src/Resolvers/ClassNameResolver.php on line 22

Additional info

Q A
Version dev
PHP version 7.3
Operating system Ubuntu 18.04

Commit composer.lock to repository

This is not a library and most of the changes relates to specific package versions/commits so commit composer.lock, package-lock.json and yarn.lock would be ok

Installation error with PHP 8 in Ubuntu 20.04

What steps will reproduce the problem?

Installing demo from composer using command "composer install"

What is the expected result?

Composer installed the demo with all the dependencies.

What do you get instead?

Php version dependency error as below:

Problem 1
- Installation request for spatie/phpunit-watcher ^1.23 -> satisfiable by spatie/phpunit-watcher[1.23.0].
- spatie/phpunit-watcher 1.23.0 requires php ^7.2 -> your PHP version (8.0.0) does not satisfy that requirement.
Problem 2
- cycle/proxy-factory v1.2.2 requires php ^7.2 -> your PHP version (8.0.0) does not satisfy that requirement.
- cycle/proxy-factory v1.2.1 requires php ^7.2 -> your PHP version (8.0.0) does not satisfy that requirement.
- cycle/proxy-factory v1.2.0 requires php ^7.2 -> your PHP version (8.0.0) does not satisfy that requirement.
- Installation request for cycle/proxy-factory ^1.2 -> satisfiable by cycle/proxy-factory[v1.2.0, v1.2.1, v1.2.2].

Additional info

Q A
Version 1.0.?
PHP version 8.0
Operating system Ubuntu 20.04

Error on path /blog/archive/<date>

What steps will reproduce the problem?

Error on path /blog/archive/

Argument 1 passed to App\Blog\Archive\ArchiveRepository::getYearlyArchive() must be of the type int, string given, called in /app/src/Blog/Archive/ArchiveController.php on line 56

Additional info

Q A
Version 1.0.?
PHP version 7.4
Operating system Docker

Remove extra parameters from ViewRenderer

Now in ViewRenderer added parameter "csrf" to all views and added parameter "user" to layout.

For add another parameters (for example, add "canonicalLink" or Facebook Open Graph Markup parameters to layout) need modify ViewRenderer class. This is not good, this is overload of class.

Need find way remove adding parameters from VeiwRenderer class.

App doesn't work from subfolder

The documentation says

The application installed according to the above instructions should work out of the box with either an Apache HTTP server or an Nginx HTTP server

What steps will reproduce the problem?

Steps from the guide (https://github.com/yiisoft/docs/blob/master/guide/en/start/installation.md):

cd /var/www/html
composer create-project --prefer-dist --stability=dev yiisoft/yii-demo yii3-app

Apache virtualhost DocumentRoot is /var/www/html

Go to http://server-name.test/yii3-app/public/

You will see We were unable to find the page /yii3-app/public/.

What is the expected result?

Work out of the box

What do you get instead?

We were unable to find the page /yii3-app/public/.

Additional info

If a separate virtual host is configured for the app as explained further in the documentation it works as expected.

Q A
Version dev
PHP version 7.3
Operating system Ubuntu 18.04

how to add backend for the app?

start a new project? any suggestions?

What steps will reproduce the problem?

What is the expected result?

What do you get instead?

Additional info

Q A
Version 1.0.?
PHP version
Operating system

This project vs the other yii3 project templates

Hi @samdark,

I realise yii3 isnt finished yet and is subject to change, but I was wondering if there was an agreed project layout to use as of yet? Is it something like this project structure or should I be using the structure similar to yii2 found here https://github.com/yiisoft/yii-base-web

yii-base-web looks more familiar to me - but yii-demo is a pinned repo and has recent commits (suggesting that is the one to use).

Being Jan 2020 I thought I would take the plunge with yii3 as its nearing release - but want to make sure I start on the right path...

Change behaviour of `render` method

What steps will reproduce the problem?

Using render function to render content of view file looks too hard.
Instead of return the result of render function we should to create response before and write data after.
Let's delegate creating the Response object to render function.

What is the expected result?

User controllers will be more simpler and cleaner

public function index(): Response
{
    return $this->render('index');
}

What do you get instead?

public function index(): Response
{
    $output = $this->render('index');
    $response = $this->responseFactory->createResponse();
    $response->getBody()->write($output);
    return $response;
}

Commands defined in config/params.php are not available in vendor/bin/yii

What steps will reproduce the problem?

Run ./vendor/bin/yii in terminal

What is the expected result?

Commands defined in config/params.php should be in the command list

'console' => [
        'commands' => [
            'user/create' => Command\User\CreateCommand::class,
            'fixture/add' => Command\Fixture\AddCommand::class,
            'router/list' => Command\Router\ListCommand::class,
        ],
    ],

What do you get instead?

изображение

I believe that the problem is caused by the recent changes in config structure and console key should be yiisoft/yii-console.

Additional info

Q A
Version dev
PHP version 7.4.6
Operating system Debian 9 (docker)

Material Design Support

Rather than an issue this one is more feauture request. Yii2 is shipped with Bootstrap 3 as an UI framework. I see, that you add Bootstrap 4 as one of the possible templates. Are there any plans on native Material Design framework support?

Class 'Yiisoft\\Router\\FastRoute\\FastRouteFactory' not found

What steps will reproduce the problem?

Clone the demo project, run composer install and open it through web server (apache).

What is the expected result?

Functional demo project.

What do you get instead?

PHP Fatal error: Uncaught Error: Class 'Yiisoft\Router\FastRoute\FastRouteFactory' not found in /var/www/html/yii-demo-master/src/Factory/AppRouterFactory.php:71\nStack trace:\n#0 /var/www/html/yii-demo-master/vendor/yiisoft/factory/src/Definitions/CallableDefinition.php(19): App\Factory\AppRouterFactory->__invoke()\n#1 /var/www/html/yii-demo-master/vendor/yiisoft/di/src/Container.php(134): Yiisoft\Factory\Definitions\CallableDefinition->resolve()\n#2 /var/www/html/yii-demo-master/vendor/yiisoft/di/src/Container.php(114): Yiisoft\Di\Container->buildInternal()\n#3 /var/www/html/yii-demo-master/vendor/yiisoft/di/src/Container.php(80): Yiisoft\Di\Container->build()\n#4 /var/www/html/yii-demo-master/vendor/yiisoft/factory/src/Definitions/Reference.php(44): Yiisoft\Di\Container->get()\n#5 /var/www/html/yii-demo-master/vendor/yiisoft/di/src/Container.php(134): Yiisoft\Factory\Definitions\Reference->resolve()\n#6 /var/www/html/yii-demo-master/vendor/yiisoft/di/src/Container.php(114): Yiisoft\Di\Container->buildInternal()\n#7 /var/www/html/yi in /var/www/html/yii-demo-master/src/Factory/AppRouterFactory.php on line 71

Additional info

Q A
Version 1.0.?
PHP version
Operating system

Error when running

Recently I installed the latest development version from composer with composer create-project --prefer-dist --stability=dev yiisoft/yii-demo app command. I got this error when running "vendor/bin/yii" serve

PHP Notice:  Undefined index: container in D:\Project\app\vendor\yiisoft\yii-console\bin\yii on line 43

Notice: Undefined index: container in D:\Project\app\vendor\yiisoft\yii-console\bin\yii on line 43
PHP Fatal error:  Uncaught Error: Function name must be a string in D:\Project\app\vendor\yiisoft\yii-console\bin\yii:43
Stack trace:
#0 D:\Project\app\vendor\yiisoft\yii-console\bin\yii(46): {closure}()
#1 {main}
  thrown in D:\Project\app\vendor\yiisoft\yii-console\bin\yii on line 43

Fatal error: Uncaught Error: Function name must be a string in D:\Project\app\vendor\yiisoft\yii-console\bin\yii:43
Stack trace:
#0 D:\Project\app\vendor\yiisoft\yii-console\bin\yii(46): {closure}()
#1 {main}
  thrown in D:\Project\app\vendor\yiisoft\yii-console\bin\yii on line 43

After that, I tried to run on Apache2, this is my apache configuration

<VirtualHost *:80>
    DocumentRoot "D:\Project\app\public"
    ServerName yii.test.local

    <Directory "D:\Project\app\public">
        Options Indexes FollowSymLinks Includes ExecCGI
        #Options FollowSymLinks Multiviews Indexes
        AllowOverride All
	Order deny,allow
    	Allow from all
        Require all granted
    </Directory>
</VirtualHost>

I got this error

Fatal error: Uncaught InvalidArgumentException: Invalid path alias: @runtime/logs/app.log in D:\Project\app\vendor\yiisoft\aliases\src\Aliases.php:141 Stack trace: #0 D:\Project\app\src\Factory\LoggerFactory.php(17): Yiisoft\Aliases\Aliases->get('@runtime/logs/a...') #1 D:\Project\app\vendor\yiisoft\factory\src\Definitions\CallableDefinition.php(19): App\Factory\LoggerFactory->__invoke(Object(Yiisoft\Di\Container)) #2 D:\Project\app\vendor\yiisoft\di\src\Container.php(214): Yiisoft\Factory\Definitions\CallableDefinition->resolve(Object(Yiisoft\Di\Container)) #3 D:\Project\app\vendor\yiisoft\di\src\Container.php(155): Yiisoft\Di\Container->buildInternal('Psr\\Log\\LoggerI...') #4 D:\Project\app\vendor\yiisoft\di\src\Container.php(88): Yiisoft\Di\Container->build('Psr\\Log\\LoggerI...') #5 D:\Project\app\vendor\yiisoft\factory\src\Definitions\ClassDefinition.php(36): Yiisoft\Di\Container->get('Psr\\Log\\LoggerI...') #6 D:\Project\app\vendor\yiis in D:\Project\app\vendor\yiisoft\aliases\src\Aliases.php on line 141

I tried to run composer dump-autoload, and got this error when running on browser

Fatal error: Uncaught RuntimeException: Alias of the root directory is not defined. in D:\Project\app\runtime\build\config\web.php:58 Stack trace: #0 D:\Project\app\vendor\yiisoft\factory\src\Definitions\CallableDefinition.php(19): {closure}(Object(Yiisoft\Di\CompositeContainer)) #1 D:\Project\app\vendor\yiisoft\di\src\Container.php(214): Yiisoft\Factory\Definitions\CallableDefinition->resolve(Object(Yiisoft\Di\CompositeContainer)) #2 D:\Project\app\vendor\yiisoft\di\src\Container.php(155): Yiisoft\Di\Container->buildInternal('Yiisoft\\Yii\\Fil...') #3 D:\Project\app\vendor\yiisoft\di\src\Container.php(88): Yiisoft\Di\Container->build('Yiisoft\\Yii\\Fil...') #4 D:\Project\app\vendor\yiisoft\yii-debug\src\Proxy\ContainerInterfaceProxy.php(171): Yiisoft\Di\Container->get('Yiisoft\\Yii\\Fil...') #5 D:\Project\app\vendor\yiisoft\yii-debug\src\Proxy\ContainerInterfaceProxy.php(56): Yiisoft\Yii\Debug\Proxy\ContainerInterfaceProxy->getInstance('Yiisoft\\Yii\\F in D:\Project\app\runtime\build\config\web.php on line 58

Do I have a mistake when configuring?

Additional info

Q A
Version 1.0.?
PHP version 7.4.4
Operating system Windows 10

Add aliases config to container

First of all it is not obvious where Aliases is coming from, I mean when doing $container->get(Aliases::class). As I've checked I see that it is configured in yii-web di container, but I think it is not obvious and we still need to add it to yii-demos common config (actually that config is supposed to be in base template, but as I understand yii-web is not a template and yii-demo is just a demo showing yii3 for the time being).

Now when I add Aliases config to this projects common config:

Aliases::class => [
    '__class' => Aliases::class,
    '__construct' => [$params['aliases']],
],

I get wrong config built by composer-config-plugin, the config built looks like this in runtime directory:

'Yiisoft\\Aliases\\Aliases' => [
    '__class' => 'Yiisoft\\Aliases\\Aliases',
    '__construct()' => [
        [
            '@root' => 'D:\\dev\\php\\tuninfo',
            '@vendor' => '@root/vendor',
            '@public' => '@root/public',
            '@runtime' => '@root/runtime',
            '@bower' => '@vendor/bower-asset',
            '@npm' => '@vendor/npm-asset',
            '@web' => '/',
        ],
    ],
    '__construct' => [
        [
            '@root' => 'D:\\dev\\php\\tuninfo',
            '@vendor' => '@root/vendor',
            '@public' => '@root/public',
            '@runtime' => '@root/runtime',
            '@bower' => '@vendor/bower-asset',
            '@npm' => '@vendor/npm-asset',
            '@web' => '/',
        ],
    ],
],

and I get following error Argument 2 passed to Yiisoft\Aliases\Aliases::__set() must be of the type string, array given in vendor\yiisoft\aliases\src\Aliases.php on line 27.

As the point 1 refers to this project I've opened the issue here, though I see that the wrong config is the issue in composer-config-plugin.

Error adding sample data

What steps will reproduce the problem?

After installing and configuring demo (with sqlite) without changing anything, running vendor\bin yii fixture/add 20 produces error.

What is the expected result?

Fixture to add random data.

What do you get instead?

[ERROR] Maximum function nesting level of '256' reached, aborting!

Additional info

Q A
Version 1.0.?
PHP version 7.4.3
Operating system Win 10 x64

yii fixture/add 10 is working ok. The error comes from Cycle ORM mapper and it's dependency zendframework/zend-hydrator. Exception is thrown on this line from yii code.
I will debug it further and open issue on Cycle repository also.

make keyPrefix default to $app->id for host-shared caches like Apc, Memcache

For shared caches, like APCu, Memcache, the defaut behaviour require to use keyPrefix, because of interpolability of hosting application, which share caches. So, defult configuration is not usabled.

I'm proposing set keyPrefix to \Yii::$app->id by default, so, the default configuration of \yii\cache\ApcCache, \yii\cache\MemCache become usable.

Q A
Yii version 2.0.20
PHP version 7.2
Operating system debian linux

CSRF fails after relogin

  1. Login.
  2. Logout.
  3. Try to login again.

Expected to log in. Got CSRF protection responding with "Unprocessable entity".

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.