Giter Site home page Giter Site logo

yiisoft / yii2-app-advanced Goto Github PK

View Code? Open in Web Editor NEW
1.6K 182.0 1.3K 1.61 MB

Yii 2.0 Advanced Application Template

Home Page: http://www.yiiframework.com

License: BSD 3-Clause "New" or "Revised" License

PHP 92.18% CSS 2.61% Batchfile 0.73% Shell 2.63% Dockerfile 0.25% Awk 1.60%
yii yii2 project-template hacktoberfest

yii2-app-advanced's Introduction

Yii 2 Advanced Project Template


Yii 2 Advanced Project Template is a skeleton Yii 2 application best for developing complex Web applications with multiple tiers.

The template includes three tiers: front end, back end, and console, each of which is a separate Yii application.

The template is designed to work in a team development environment. It supports deploying the application in different environments.

Documentation is at docs/guide/README.md.

Latest Stable Version Total Downloads build

DIRECTORY STRUCTURE

common
    config/              contains shared configurations
    mail/                contains view files for e-mails
    models/              contains model classes used in both backend and frontend
    tests/               contains tests for common classes    
console
    config/              contains console configurations
    controllers/         contains console controllers (commands)
    migrations/          contains database migrations
    models/              contains console-specific model classes
    runtime/             contains files generated during runtime
backend
    assets/              contains application assets such as JavaScript and CSS
    config/              contains backend configurations
    controllers/         contains Web controller classes
    models/              contains backend-specific model classes
    runtime/             contains files generated during runtime
    tests/               contains tests for backend application    
    views/               contains view files for the Web application
    web/                 contains the entry script and Web resources
frontend
    assets/              contains application assets such as JavaScript and CSS
    config/              contains frontend configurations
    controllers/         contains Web controller classes
    models/              contains frontend-specific model classes
    runtime/             contains files generated during runtime
    tests/               contains tests for frontend application
    views/               contains view files for the Web application
    web/                 contains the entry script and Web resources
    widgets/             contains frontend widgets
vendor/                  contains dependent 3rd-party packages
environments/            contains environment-based overrides

yii2-app-advanced's People

Contributors

arhell avatar arogachev avatar bscheshirwork avatar cebe avatar creocoder avatar davertmik avatar deryabinsergey avatar developedsoftware avatar githubjeka avatar jasrags avatar kartik-v avatar klimov-paul avatar maximal avatar mohorev avatar naktibalda avatar pana1990 avatar pastuhov avatar qiangxue avatar ragazzo avatar resurtm avatar rugabarbo avatar samdark avatar schmunk42 avatar sdkiller avatar silverfire avatar skiptirengu avatar slavcodev avatar softark avatar thiagotalma avatar trianman 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  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

yii2-app-advanced's Issues

init enhacement

init doesn't show error message when directory doesn't exist when applying chmod(writable) command.
For example if directory frontend/web/img/companies exist, init show:
chmod 0777 frontend/web/img/companies
And if directory frontend/web/img/peoples doesn't exist, init show the same:
chmod 0777 frontend/web/img/peoples

Configuration and environments doc clarification

Some quotes from https://github.com/yiisoft/yii2-app-advanced/blob/master/docs/guide/structure-environments.md:

•Each team member has its own configuration options. Committing such config will affect other team members.
•Production database password and API keys should not end up in the repository.

config files suffixed with -local.php . These are added to .gitignore and never added to source code repository.

It would be nice to explicitly state that:

  1. team member config goes into -local files of dev environment.
  2. Production database password goes into the -local files of prod environment.
    Unless my understanding is incorrect and then a proper explanation should be provided.

yii2 migration

Hello, I am trying to something with migration.
when I run "php yii migrate" I am getting
"Exception 'ReflectionException' with message 'Class db does not exist'
in /var/www/yii2.uz/vendor/yiisoft/yii2/di/Container.php:415"
what is problem

Bootstrap extension version 2.0.5 is not synchronised with yii's version

In documentation for :

It is stated "Available since version 2.0.5"...

But as yii version 2.0.6 bundle in yii-advanced-app-2.0.6 (same in yii-basic-app-2.0.6), they are not included yet.

I feel like this discrepancy doesn't make sense. Maybe the availability in documentation might gain to be changed and stated for the next version? Or the bundles updated?

I finally start to think that yii numbering version 2.0.6 has no direct relation with yii-bootstrap numbering version 2.0.5.
In this case, the documentation might be clearer on which version it is speaking. It is not obvious to dive into each component to know the version running into the main yii version we are developping (so it would rather be a guide issue).

can not install and update yii2-app

Hello, I am trying run the command <composer create-project --prefer-dist yiisoft/yii2-app-advanced yii2-application>. I get error message <[UnexpectedValueException] Could not parse version constraint <=2.*: Invalid version string "2.*"> This problem began to appear with version yii2.0.6

Codeception tests fail when app is in a vagrant box

Followed the test instructions for Yii2 advanced application. Everything up to the codecept build works as intended. However when running the actual tests this is the results:

[vagrant@localhost frontend]$ codecept run
Codeception PHP Testing Framework v2.1.3
Powered by PHPUnit 4.8.10 by Sebastian Bergmann and contributors.

Tests\codeception\frontend.acceptance Tests (5) ---
Ensure that signup works (acceptance\SignupCest::testUserSignup) Fail
Ensure that about works (AboutCept) Fail
Ensure that contact works (ContactCept) Fail
Ensure that home page works (HomeCept) Fail
Ensure login page works (LoginCept) Fail


Tests\codeception\frontend.functional Tests (5) ---
Ensure that signup works (functional\SignupCest::testUserSignup) Ok
Ensure that about works (AboutCept) Ok
Ensure that contact works (ContactCept) Ok
Ensure that home page works (HomeCept) Ok
Ensure login page works (LoginCept) Ok


Tests\codeception\frontend.unit Tests (8) ---
Trying to test contact (unit\models\ContactFormTest::testContact)...

PHP Fatal Error 'yii\base\ErrorException' with message 'Call to undefined function tests\codeception\frontend\unit\models\expect()'

in /var/www_vagrant/yii2-advanced-app/tests/codeception/frontend/unit/models/ContactFormTest.php:42

Stack trace:
#0 phar:///usr/bin/codecept/vendor/codeception/specify/src/Codeception/Specify.php(97): ::call_user_func_array:{phar:///usr/bin/codecept/vendor/codeception/specify/src/Codeception/Specify.php:97}()
#1 phar:///usr/bin/codecept/vendor/codeception/specify/src/Codeception/Specify.php(50): tests\codeception\frontend\unit\models\ContactFormTest->specifyExecute()
#2 /var/www_vagrant/yii2-advanced-app/tests/codeception/frontend/unit/models/ContactFormTest.php(43): tests\codeception\frontend\unit\models\ContactFormTest->specify()
#3 phar:///usr/bin/codecept/vendor/phpunit/phpunit/src/Framework/TestCase.php(886): tests\codeception\frontend\unit\models\ContactFormTest->testContact()
#4 phar:///usr/bin/codecept/vendor/phpunit/phpunit/src/Framework/TestCase.php(886): ReflectionMethod->invokeArgs()
#5 phar:///usr/bin/codecept/vendor/phpunit/phpunit/src/Framework/TestCase.php(746): PHPUnit_Framework_TestCase->runTest()
#6 phar:///usr/bin/codecept/vendor/phpunit/phpunit/src/Framework/TestResult.php(601): PHPUnit_Framework_TestCase->runBare()
#7 phar:///usr/bin/codecept/vendor/phpunit/phpunit/src/Framework/TestCase.php(702): PHPUnit_Framework_TestResult->run()
#8 phar:///usr/bin/codecept/vendor/phpunit/phpunit/src/Framework/TestSuite.php(735): PHPUnit_Framework_TestCase->run()
#9 phar:///usr/bin/codecept/src/Codeception/PHPUnit/Runner.php(89): PHPUnit_Framework_TestSuite->run()
#10 phar:///usr/bin/codecept/src/Codeception/SuiteManager.php(153): Codeception\PHPUnit\Runner->doEnhancedRun()
#11 phar:///usr/bin/codecept/src/Codeception/Codecept.php(203): Codeception\SuiteManager->run()
#12 phar:///usr/bin/codecept/src/Codeception/Codecept.php(172): Codeception\Codecept->runSuite()
#13 phar:///usr/bin/codecept/src/Codeception/Command/Run.php(262): Codeception\Codecept->run()
#14 phar:///usr/bin/codecept/src/Codeception/Command/Run.php(189): Codeception\Command\Run->runSuites()
#15 phar:///usr/bin/codecept/vendor/symfony/console/Command/Command.php(259): Codeception\Command\Run->execute()
#16 phar:///usr/bin/codecept/vendor/symfony/console/Application.php(878): Symfony\Component\Console\Command\Command->run()
#17 phar:///usr/bin/codecept/vendor/symfony/console/Application.php(195): Symfony\Component\Console\Application->doRunCommand()
#18 phar:///usr/bin/codecept/vendor/symfony/console/Application.php(126): Symfony\Component\Console\Application->doRun()
#19 phar:///usr/bin/codecept/codecept(34): Symfony\Component\Console\Application->run()
#20 /usr/bin/codecept(7): ::unknown()

Hardware has fe.yii2-advanced-app.dev and be.yii2-advanced-app.dev pointed to vagrant machine; both load in a browser no problem. I can even navigate around the application. But the tests die :(.

tests runtime folder not ignored by version control.

Hey guys. Upon setting up FileCache with the following in my common/main.php:

'cache' => [
    'class' => 'yii\caching\FileCache',
],

When I run tests on tasks that use the cache the cache files are saved into tests/codeception/config/runtime. I'm quite satisfied with this behavior. There is however one issue in that the runtime folder is in no .gitignore so running tests locally will result in the runtime folder being picked up by the VCS (git).

I will cover this in our project but was wondering if it wasn't a good idea to do this in the skeleton as well (Since Yii2 covers such cases in (frontend | backend | console)/runtime).

I would suggest having a tests/codeception/runtime folder with a tests/codeception/runtime/.gitignore

init command stopped creating assets folders

Recently I noticed that init command stopped creating folders backend/assets and frontend/assets. The permissions for creating folders are OK. What's the problem? Is it a bug or this feature was removed? I have to do it manually now.

P.S. This happens on both local and production servers, nothing has changed on local server in terms of permissions. Previously these folders were creating without problems.

Cannot add my own commands

Is it possible that the configuration is not correct? I added a class to console/controllers in file DatabaseController.php:

namespace app\console\controllers;

use Yii;
use yii\console\Controller;

class DatabaseController extends Controller {
    public function actionTest() {

    }
}

but when I run ./yii database/test I get the error:

Error: Unknown command 'database/test/.

Do I have to call it differently?

Sessions are shared between backend and frontend

Install yii2-app-advanced, create user accounts, fill up the login form in the frontend application.
Now open the backend application: no login needed, authentication is shared!

The problem is that PHP sessions are shared by default among all the PHP pages. This means that authenticating in one application on the server may induce authentication in other applications (you may need to alter the "domain" part of the cookie, if the access goes through distinct virtual hosts on the same PHP server).

The solution is to save sessions in directories local to each application. PR follows.

FR: "Skip if exists" for init-command

I would like to be able to skip files if they exist during init.

Because of security I do not store my database password files in source control. too many people cooperate on the project that do not need them. Instead my environments folder contains a template configuration file but with "" instead of the passwords.

The files are initially installed as part of the init command (which I LOVE btw!) and then get updated on the server itself. These don't often change (only when we rotate passwords), but the regular config does once in a while, requiring a new init to put them in place.

I would love to be able to say that "if this file exists, never overwrite this", so that I don't have to update the passwords file every time this happens. I can implement this myself (perhaps a "locked" config entry) and issue a PR if it is deemed useful here.

email should not be unique

The email in user table should not be unique.
So I changed the file user.php in common/models also i changed the SignupForm.php in frontend/models and m130524_201442_init.php in console/migrations but than i get this error

Integrity constraint violation – yii\db\IntegrityException

SQLSTATE[23000]: [Microsoft][SQL Server Native Client 11.0][SQL Server]Violation of UNIQUE KEY constraint 'UQ__user__665877D04E88ABD4'. Cannot insert duplicate key in object 'dbo.user'. The duplicate key value is ().
The SQL being executed was: INSERT INTO [user]([username], [email], [password_hash], [auth_key], [status_id], [role_id], [user_type_id], [created_at], [updated_at]) VALUES ('test1', '[email protected]', '$2y$13$zV48OV5q5MpLIx/GxiRDBuKqcBRmOZITx76i24u1KwmAqFKan49QS', 'eY7UxwlK3wZ-PK8Ami3nUGinKFJ6GTJJ', 1, 1, 1, GETDATE(), GETDATE())
Error Info: Array
(
[0] => 23000
[1] => 2627
[2] => [Microsoft][SQL Server Native Client 11.0][SQL Server]Violation of UNIQUE KEY constraint 'UQ__user__665877D04E88ABD4'. Cannot insert duplicate key in object 'dbo.user'. The duplicate key value is ().

Please can u help me

The missing '@' prefix of setAlias('common', ...)

I'm puzzled about the usage of setAlias() in common/config/bootstrap.php:

Yii::setAlias('common', dirname(__DIR__));
...

That is, the common argument doesn't have a @ prefix. The API of BaseYii::setAlias() has emphasized that the @ prefix is required:

the alias name (e.g. "@Yii"). It must start with a '@' character.

BaseYii.php Line 199

Although

Alias defined without leading @ will be prefixed with @ character.

Guide 2.0 Key Concepts - Aliases

, it would be better that we always prefix a @ character when setting aliases.

when using migration arise some problems

Call to undefined method yii\db\Schema::primaryKey()

~/www/httproot/yii2-app-advanced $ yii migrate
Yii Migration Tool (based on Yii v2.0.6-dev)

Creating migration history table "migration"...Done.
Total 1 new migration to be applied:
    m130524_201442_init

Apply the above migration? (yes|no) [no]:y
*** applying m130524_201442_init
PHP Fatal error:  Call to undefined method yii\db\Schema::primaryKey() in ~/www/httproot/yii2-app-advanced/console/migrations/m130524_201442_init.php on line 17
...

can not install and update yii2-app

When I do command <composer create-project --prefer-dist yiisoft/yii2-app-advanced yii2-application> I get error message <[UnexpectedValueException] Could not parse version constraint <=2.*: Invalid version string "2.*"> This problem began to appear with version yii2.0.6

Documentation issue on using the yii migrate command

After the first time installation of the yii2-app-advanced on a LAMP server on Ubuntu 14.04 I could not run the migration with the command documented here.
I.e the instruction to run yii migrate

I was able to get the migrations to run by typing ./yii migrate

I don't know if it's an issue with the PATH but I believe the second option of the ./yii should be added to this documentation

Cannot logout when Javascript is disabled

Both frontend and backend require the logout request to use a POST verb. Yet the top menu uses a simple HTML link, with an extra HTML attribute that Javascript uses to forge a POST request. When JS is disabled in the web browser, clicking on the logout link sends to an error page.

I can see 2 ways out:

  1. Warn the final user that Javascript is required in the demo application.
  2. Remove the "verbs" filter at the top of (backend|frontend)/controllers/SiteController.php.
    A slight variant is to comment these lines, so that the filtering capacity is still visible, but is disabled by default with a short explanation.

themeing module not working?

Hi,
in basic application theming modules work currectly for me by configing following: http://www.yiiframework.com/doc-2.0/guide-output-theming.html#theming-modules

but when i setup that configuration in advanced application it's dosent work. my config in frontend:
'view' => [
'theme' => [
'pathMap' => [
'@frontend/views' => '@themes/test/frontend/views',
'@frontend/modules' => '@themes/test/frontend/modules',
],
],
],

first one : '@frontend/views' => '@themes/test/frontend/views', work currectly but second : '@frontend/modules' => '@themes/test/frontend/modules', that's for module dosen't work.
Am i done some thing worng? or it is a bug?

bower-asset path has a problem

can't find /vendor/bower/bootstrap,

when update composer,bower/bootstrap path has changed,now in vendor/bower/bower-asset/bootstrap

please update!

Yii not resolve aliases from common/config/bootstrap.php in GII

Aliases are used to represent file paths or URLs so that you don't have to hard-code absolute paths or URLs in your project. An alias must start with the @ character to be differentiated from normal file paths and URLs.

When I put in "View Path" on gii generator http://mysite.com/gii/controller
path like "frontend/views/users" Gii said

Unable to create the directory 'frontend/views/users'.
When I change alias to @frontend in common/config/bootstrap.php Gii works correctly.

If I made a mistake somewhere - show me where please 😃

Besides I don't understand why aliases in bootstrap.php made without "@" which contradicts documentation rules.

helpers\Html -> bootstrap\Html

Since yii2-app-advanced is Bootstrap-based things like:

use yii\helpers\Html;
use yii\bootstrap\ActiveForm;

should be changed to

use yii\bootstrap\Html;
use yii\bootstrap\ActiveForm;

etc.

I cant add extra fields in step registration user

Hi, I cant add extra fields directly in core, my files modified are:

i modified my init migration file for add mynewfield

later in app/common/models/user.php
class User extends \yii\db\ActiveRecord implements IdentityInterface
{

public $mynewfield;

......

later in app/frontend/models/signupForm.php
at start the class SignupForm

public $mynewfield;

in public function signup()
{ if ( $this->validate() && Yii::$app->request->post()) {
$user = new User();
$user->username = $this->username;
$user->email = $this->email;
$user->mynewfield= $this->mynewfield;

and my view add the new field, but in the process of registration mynewfield is empty, what i can do for add my extra field without others extensions.

Logout with a javascript disabled browser generates "Method Not Allowed" error

<h1>Method Not Allowed (#405)</h1>

    <div class="alert alert-danger">
        Method Not Allowed. This url can only handle the following request methods: POST.    </div>

Imagine somebody uses a public computer with a javascript disabled browser, login on a website and can no more logout.

$ find common/ environments/ backend/ console/ frontend/ -name \*.php -exec grep -i --with-filename --line-number --color -e logout -e post \{\} \;
backend/controllers/SiteController.php:29:                        'actions' => ['logout', 'index'],
backend/controllers/SiteController.php:38:                    'logout' => ['post'],
backend/controllers/SiteController.php:68:        if ($model->load(Yii::$app->request->post()) && $model->login()) {
backend/controllers/SiteController.php:77:    public function actionLogout()
backend/controllers/SiteController.php:79:        Yii::$app->user->logout();
backend/views/layouts/main.php:44:            'label' => 'Logout (' . Yii::$app->user->identity->username . ')',
backend/views/layouts/main.php:45:            'url' => ['/site/logout'],
backend/views/layouts/main.php:46:            'linkOptions' => ['data-method' => 'post']
frontend/controllers/SiteController.php:29:                'only' => ['logout', 'signup'],
frontend/controllers/SiteController.php:37:                        'actions' => ['logout'],
frontend/controllers/SiteController.php:46:                    'logout' => ['post'],
frontend/controllers/SiteController.php:90:        if ($model->load(Yii::$app->request->post()) && $model->login()) {
frontend/controllers/SiteController.php:104:    public function actionLogout()
frontend/controllers/SiteController.php:106:        Yii::$app->user->logout();
frontend/controllers/SiteController.php:119:        if ($model->load(Yii::$app->request->post()) && $model->validate()) {
frontend/controllers/SiteController.php:152:        if ($model->load(Yii::$app->request->post())) {
frontend/controllers/SiteController.php:173:        if ($model->load(Yii::$app->request->post()) && $model->validate()) {
frontend/controllers/SiteController.php:203:        if ($model->load(Yii::$app->request->post()) && $model->validate() && $model->resetPassword()) {
frontend/views/layouts/main.php:47:            'label' => 'Logout (' . Yii::$app->user->identity->username . ')',
frontend/views/layouts/main.php:48:            'url' => ['/site/logout'],
frontend/views/layouts/main.php:49:            'linkOptions' => ['data-method' => 'post']
'linkOptions' => ['data-method' => 'post']

This is not an official HTML option, but just an option for the javascript code.

backend/controllers/SiteController.php-35-            'verbs' => [
backend/controllers/SiteController.php-36-                'class' => VerbFilter::className(),
backend/controllers/SiteController.php-37-                // 'actions' => [
backend/controllers/SiteController.php:38:                //     'logout' => ['post'],
backend/controllers/SiteController.php-39-                // ],
backend/controllers/SiteController.php-40-            ],

Suppressing lines 37-39 allows logout. The same for the frontend should probably also do it.

"composer update " takes too much time almost 2 hours .. finally send an error

Error :
[Composer\DependencyResolver\SolverProblemsException]
Problem 1
- yiisoft/yii2 dev-master requires bower-asset/jquery.inputmask 3.1.* -> no matching package found.
- yiisoft/yii2 2.0.x-dev requires bower-asset/jquery.inputmask 3.1.* -> no matching package found.
- Installation request for yiisoft/yii2 >=2.0.6 -> satisfiable by yiisoft/yii2[2.0.x-dev, dev-master].
Potential causes:

Vagrantfile

Are there any plans to add Vagrantfile in repo?
I think it would be nice for developers to have configured web server and database out of the box.

user table insecure

in table user the columns username and password_reset_token should be given an unique key. otherwise the implementations of findByUsername and findByPasswordResetToken could return unexpected results.

Inconsistency in accessing session component

Throughout the code of frontend/controllers/SiteController.php (and in one place of frontend\widgets\Alert.php) the 'session' component of web application is accessed differently for no apparent reason, for ex.:

Yii::$app->session->setFlash('error', 'There was an error sending email.');

or

Yii::$app->getSession()->setFlash('error', 'Sorry, we are unable to reset password for email provided.');

This should be changed to the same style ( ->session or ->getSession() ) for consistency reasons.

Violation of UNIQUE KEY constraint for column password_reset_token

Integrity constraint violation – yii\db\IntegrityException

SQLSTATE[23000]: [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Violation of UNIQUE KEY constraint 'UQ__user__665877D008EA5793'. Cannot insert duplicate key in object 'dbo.user'.

Error Info: Array
(
[0] => 23000
[1] => 2627
[2] => [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Violation of UNIQUE KEY constraint 'UQ__user__665877D008EA5793'. Cannot insert duplicate key in object 'dbo.user'.
)

ContactCept functional & acceptance type

There's a type in both files:
acceptance/ContactCept line 38
functional/ContactCept line 32

$I->expectTo('see that email adress is wrong'); should be $I->expectTo('see that email address is wrong');

Working on pull request.

Can't build/install the advanced template project

I can't build or install the advanced template project due to the following error. Is this a yii2 project bug or an advanced template project bug (or something else)?

I cannot get the yii2 advanced template application to build. I have not specified a stability flag -- but the default should be stable, yes?

$ composer --version
Composer version 1.0-dev (bd2d7eba05dc6a51dbbad780b6f0eb505accba75) 2015-07-31 08:06:09

$ composer create-project --prefer-dist yiisoft/yii2-app-advanced yii2-advanced
Installing yiisoft/yii2-app-advanced (2.0.4)

  • Installing yiisoft/yii2-app-advanced (2.0.4)

Created project in yii2-advanced
Loading composer repositories with package information
Installing dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

Problem 1
- yiisoft/yii2 2.0.5 requires bower-asset/jquery 2.1.@stable | 1.11.@stable -> no matching package found.
- yiisoft/yii2 2.0.4 requires bower-asset/jquery 2.1.@stable | 1.11.@stable -> no matching package found.
- Installation request for yiisoft/yii2 >=2.0.4 -> satisfiable by yiisoft/yii2[2.0.4, 2.0.5].

Potential causes:

Read https://getcomposer.org/doc/articles/troubleshooting.md for further common problems.

Nowrap for grid view

Yii2 issue #8771

.grid-view th {
    white-space: nowrap;
}

This rule is not necessary for all columns and it's probably not necessary for the header line. The only thing this parameter must be set for certain cells, such as, ActionColumn.

I propose to add a helper class 'text-nowrap' and add it to the cells if necessary.

backend/web/css/site.css and frontend/web/css/site.css

.text-nowrap {
    white-space: nowrap;
}

common/confog/bootstap.php

\Yii::$container->set('yii\grid\ActionColumn', [
    'contentOptions' => [
        'class' => 'text-nowrap'
    ]
]);

Gii generated relations that point to the same model, cannot update

I have posted this on stackoverflow.
I didn't receive any answer, so I thought that this may be a good place to ask.
Although, I am Yii newbie, I am quite capable of conceptualizing. I have tracked this down to traits or behaviors.
In pure transaction approach I would hold the values in local variables and then insert/update as needed, but I want to use Yii's approach. Eg. how do I tell the ActiveForm renderer that first text field refers to text.content column, but as question.
Please, just point me in the right direction and I would be more than grateful.
Don't be to harsh on me!

[bug?] Backend renders "<?php" into every empty controller

There's a weird little issue in the advanced version of Yii 2.0.3:

In the backend, every controller renders a response than ALWAYS has "<?php" in the beginning. You can test this by creating an empty controller, running it and looking at the output source (CTRL+U in firefox).

You'll probably just see <?php.

This get problematical when rendering out files that seriously brake when starting with <?php.

You can "fix" this by commenting out the line

require(__DIR__ . '/../config/bootstrap.php');

in the backend's index.php or by adding a return to the bootstrap,.php

Can somebody confirm ?
Have a great day guys.

FixtureHelper does not run InitDbFixture

The FixtureHelper does not run InitDbFixture and it does not disable integrity checks during the initialization resulting in yii\db\IntegrityException when clearing tables with foreign keys.

The issue does not appear with unit tests, only with functional and acceptance tests.

What would be the suggested workaround for this? The db object cannot be accessed in FixtureHelper so adding checkIntegrity(false/true) wrappers around the load/unloadFixture calls does not work.

Is there a way to form routes like `http://api.app.com/v1/controller/action?params` ?

It is a question.

I used advanced-template, and made directories like this:

- project-root-directory
    -- common
    -- v1
    -- v2

I know that I can easily use two domain:

 `apiv1.app.com`  for `project/v1/web` and  `apiv2.app.com`  for `project/v2/web`

I have tried using modules, but I found that way is nested and complex, I do not want it.

Is there a way to form routes like api.app.com/v1/controller/action?params.

I tried rewrite in nginx server block like this:

server {
    server_name api.app.o;
    root /srv/http/project-root-directory;
    location / {
        index index.php;
        rewrite ^/v1(.*)$ /v1/web/index.php?$1 last;
        return 403;
    }
    location ~ \.php$ {
        fastcgi_pass   unix:/run/php-fpm/php-fpm.sock;
        fastcgi_index  index.php;
        include        fastcgi.conf;
    }
}

That only execute v1\controller\SiteController::index(), even i request like api.app.o/v1/a/b/c?d=f.

Advanced Template installation issue [ErrorException] touch(): Utime failed: Permission denied

I am using YII2 for my project,I have created a project(advanced template) using composer, now I need to start another project, firstly I have update composer(composer self-update), it is fine. now I am trying to complete installation process of YII2 advanced template on my lampp using composer, on the step Configuring Composer getting following error,

[ErrorException]

touch(): Utime failed: Permission denied

can someone help me, why the problem is occur in 2nd time installation? thanks

can you check this http://stackoverflow.com/q/33119025/5443859

Vendor

Where is the vendor directory?

Codeception tests & \Yii::$container problem

Hi,
I found strange behavior during tests execution. I defined class implementation using \Yii::$container like this:

\Yii::$container->set('\common\src\dict\ICarOwnerDictionary','\common\src\dict\CarOwnerDictionary');

in

 common/config/bootstrap.php

everything works ok until i try to run backend/functional tests. It is simple Cept test where I try to display page which gets dictionary implementation from \Yii::$container and display entries.

And there is the problem:

  1. If I run backend application works perfect (in browser).
  2. If I execute only functional test for backend - works fine
  3. If I execute the whole tests - does not work. There is empty \Yii:$container (debugged).

I found workaround, simply move 'common' test execution at the end - in tests/codeception.yml like this

include:
  - codeception/backend
  - codeception/frontend
  - codeception/console
  - codeception/common

paths:
  log: codeception/_output

settings:
  colors: true

After this change works perfect. It looks like only general _bootstrap file is executed once at the beginning and testing 'common' destroys \Yii:$container.

I spent a while (long while) and I only found above workaround, maybe I did something wrong? Any idea?
Regards,
Jarek

Enable pretty urls by default

I think this part of the config:

'urlManager' => [
    'enablePrettyUrl' => true,
    'showScriptName' => false,
],

should be not commented and included by default because it's used more often.

"Configuration and environments", configs of team members

"Configuration and environments" doc states that yii2-app-advanced template somehow solves the problem of different team members having different -local.php configs under dev environment. But all -local.php configs go under environments/dev folder which is commited in its entirety (since there are no .gitignore files for environments folder or inside it). So it is unclear where does each team member keep his copies of -local.php configs and how and when (before or after or during php yii init) that team member's copies of -local.php configs are copied into final project folders.

Namespaces mess

I'm checking the sample codeception tests, and $actor variable in AboutPage.php is defined as
* @property \codeception_frontend\AcceptanceTester|\codeception_frontend\FunctionalTester $actor.
I can't find where the namespace codeception_frontend is defined. I guess it should be tests\codeception\frontend.

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.