Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] added migration namespaces to options, added alias syntax support #13359

Closed
wants to merge 1 commit into from

Conversation

schmunk42
Copy link
Contributor

Q A
Is bugfix? it depends ;)
New feature? yes
Breaks BC? no
Tests pass? tbd
Fixed issues #13356

@schmunk42 schmunk42 changed the title added migration namespaces to options, added alias syntax support [WIP] added migration namespaces to options, added alias syntax support Jan 10, 2017
@samdark
Copy link
Member

samdark commented Jan 10, 2017

I don't see any pros in merging it so it's up to @cebe who has more experience with this topic.

@schmunk42
Copy link
Contributor Author

One thing is migrationNamespaces - is there a reason why this should NOT be available on the CLI?


The second change is about supporting migrations in global namespaces, like how they had to be used until 2.0.9.

If there's no support, we'll end up in including an extension which does that, because otherwise ALL extensions with non-namespaced migrations would be useless in 2.1 (if migrationPath will be deprecated).

As said, there might be nicer options for the syntax or a parameter to enable the fallback, ideas welcome.

CC: @cebe @klimov-paul

@klimov-paul
Copy link
Member

One thing is migrationNamespaces - is there a reason why this should NOT be available on the CLI?

In general I can see no reason for exposing this param at CLI level as it is unlikely to be changed frequently. But this is debatable of course.

The second change is about supporting migrations in global namespaces, like how they had to be used until 2.0.9.

Support of the global namespace is still present via migrationPath. In the future major version support for non-namespaced classes will be dropped as they make no sense. Modern PHP application should not use classes without namespaces in general. I can see no problem in this.

@klimov-paul
Copy link
Member

Both migrationPath and migrationNamespaces can be used at the same time without any troubles.

@samdark
Copy link
Member

samdark commented Jan 10, 2017

Having it available via parameter makes no harm and is in line with migrationPath which is available.

@schmunk42
Copy link
Contributor Author

schmunk42 commented Jan 10, 2017

In general I can see no reason for exposing this param at CLI level as it is unlikely to be changed frequently. But this is debatable of course.

Since migrationPath was available and it's widely used from my experience - every extension with migrations has to be installed using it, I would definitely enable it.

@schmunk42
Copy link
Contributor Author

Support of the global namespace is still present via migrationPath

It supports only one, not multiple - that was the reason why I created yii2-migration-command in the first place. Cebe implemented this in Yii 1. That's what the very initial feature request was all about.

As said in my first posting, we'll end up in using an extension, which should actually be obsolete with the changes from 2.0.10.

@klimov-paul
Copy link
Member

It supports only one, not multiple - that was the reason why I created yii2-migration-command in the first place. Cebe implemented this in Yii 1. That's what the very initial feature request was all about.

I am already tired of this argument appearing over and over again. We have made a decision at #384 in favor of namespaces, which are modern way to resolve such task. If you prefer to code your project without namespaces like it was several years ago - it is your choice. I can see absolutely no reason for supporting old-fasion coding approach.

@schmunk42
Copy link
Contributor Author

In the future major version support for non-namespaced classes will be dropped as they make no sense. Modern PHP application should not use classes without namespaces in general. I can see no problem in this.

It would render all migrations not upgrading their migrations obsolete, just for no real reason. The chance of conflicts is still pretty low - do you know of any conflict with a migration name in Yii 1 or 2?

For sure it should not be enabled by default. You may think about a full deprecation in 2.2. It makes no sense to enforce this policy in such a strong way, since people will work around that and we'll end up in the same situation, needing a 3rd party extension to run multiple migrations of 2.0 extensions.

And let's be honest, nobody wants this discussion again.

@schmunk42
Copy link
Contributor Author

schmunk42 commented Jan 10, 2017

If you prefer to code your project without namespaces like it was several years ago - it is your choice. I can see absolutely no reason for supporting old-fasion coding approach.

You're just breaking things for the sake of it. I also really tired of this.

@samdark
Copy link
Member

samdark commented Jan 10, 2017

@schmunk42 but nothing is broken, isn't it? Namespaces are optional, extension works as before if these are not enabled, right?

@schmunk42
Copy link
Contributor Author

@samdark Not in 2.1, as planned.

@samdark
Copy link
Member

samdark commented Jan 10, 2017

What do you mean?

@samdark
Copy link
Member

samdark commented Jan 10, 2017

Namespaces are a way to solve the same problem you're trying to solve. There's no point in having two similar ways to solve it. Additionally, you're not forced to use these. You can stick to no-namespace approach which works exactly the same as it did before. So extension will still work well.

@schmunk42
Copy link
Contributor Author

schmunk42 commented Jan 10, 2017

How would you run multiple migrations in 2.1, like some from @app/migrations, @vendor/a/b and @vendor/c/d. If the vendor packages are not updated already and if they can't be run one after each other.

The whole point about this feature is not isolation - that has never been a real world problem with migrations.
People struggle with running migrations from different locations and bringing them into the correct order.

While our command solves this problem, whether they are namespaced or not - the current implementation is completely ignoring how things out there work. Instead of making a migration-extension obsolete with one fallback parameter and half a dozen lines of code.

@samdark
Copy link
Member

samdark commented Jan 10, 2017

OK. So the real issue is the migration from no namespaces to namespaces in the middle of the project with 200 migrations?

@schmunk42
Copy link
Contributor Author

That would be a huge issue yes, especially if they are located in vendor.

@samdark
Copy link
Member

samdark commented Jan 10, 2017

So it's not really about aliases at all. It's about reading from both namespaces and non-namespaces at the same time, right?

@schmunk42
Copy link
Contributor Author

So it's not really about aliases at all. It's about reading from both namespaces and non-namespaces at the same time, right?

Yes. It would be fair enough if you need to adjust your migration config after a change to 2.1. I have no-problem with that. The code in the PR shows this.

@samdark
Copy link
Member

samdark commented Jan 10, 2017

The fallback to old behavior should be optional.

@samdark
Copy link
Member

samdark commented Jan 10, 2017

As for migrating from no-namespaces to namepsaces, the case itself is important for existing projects.

@samdark samdark added this to the 2.0.12 milestone Jan 10, 2017
@samdark samdark added status:under discussion status:to be verified Needs to be reproduced and validated. labels Jan 10, 2017
@klimov-paul
Copy link
Member

Converting namespaced classes to non-namespaced is inconsistent.
Consider following PHP class autoloading example:

$obj = new \app\migrations\Foo();

At this code I expect $obj to be populated by instance of \app\migrations\Foo. If such class does not exist Iexpect to get en error message.
Now following proposed concept, this code should create me instance of class \Foo in case \app\migrations\Foo does not exist but \Foo does exist.

Providing such fallback makes code to be risk prone. If migrationNamespaces has been specified it should seek for namespaced classes as well as in example above.

Second concern is migration history. Using namespaces was a solution to the history loss problem. Fully qualified class name is stored in migration history table. Thus while reverting or re-applying migration you have no need to seek for the correct migration source path - it is already present in the class namespace.
Even if particular namespace has been removed from migrationNamespaces list already applied migration can still be reverted as it will be found using native PHP class autoloading mechanism.

With this change migration applied via non-namespace fallback will be unable for revertion as there is no iteration over namespaces during this process.

This is the point why I consider exposing migrationNamespaces to the CLI to be redundant. While operating migrationPath there were no other way to use different source locations, migrationNamespaces can contain as much values as needed including every extension you use.
You can configure it just once at console application config and then use always. Switching its value seems to be completely redundant work to me in such scope.

@klimov-paul
Copy link
Member

the real issue is the migration from no namespaces to namespaces in the middle of the project with 200 migrations?

You can refactor your migrations source code adding a namespace for them.
Then you can use yii migrate/mark command to clear the old migration history and then apply the new one containing namespaces.
It does not sounds so bad to me.

or sure it should not be enabled by default. You may think about a full deprecation in 2.2.

This has not been yet decided. There is no due date even for 2.1 milestone. And there is no final decision is migrationPath will be removed or not. In fact several years may pass before this matter will become today issue. I can see no reason to be worry.

@klimov-paul
Copy link
Member

While our command solves this problem, whether they are namespaced or not - the current implementation is completely ignoring how things out there work. Instead of making a migration-extension obsolete with one fallback parameter and half a dozen lines of code.

I am not sure if I understand this correctly.
Using of namespaces for migrations will make necessity of operating migrationPath obsolete. All we need to do is just wait for extensions to pick up the improvement.
That is why I consider we can drop migrationPath in the future as it will make no sense.
Still I do not like the idea of supporting 2 different approaches for the same sake.

If particular extension wishes to support both namespaced and non-namespaced migrations following tricks might provide it:

  1. You can declare migration classes twice: one namespaced with actual code and another one non-namespaced, which just extends it:
// file `migrations/namespaced/M123...Init.php`
namespace ext\foo\migrations\namespaced;

class M123...Init extends \yii\db\Migration
{
    public function up() {}

    public function down() {}
}

// file `migrations/m123...init.php`
class m123...init extends \ext\foo\migrations\namespaced\M123...Init
{
    // empty: code inherited
}
  1. You may also pick both those classes into a single file declaring namespaced and non-namespaced classes at same time:
// file `migrations/m123...init.php`

namespace ext\foo\migrations
{
    class m123...init extends \yii\db\Migration
    {
        public function up() {}

        public function down() {}
    }
}

// same file, out of `namespace` block
class m123...init extends \ext\foo\migrations\m123...init
{
    // empty: code inherited
}

Although both ways are little inconsistent they allows you usage of new feature keeping a BC.

@@ -186,6 +187,12 @@ protected function createMigration($class)
if (strpos($class, '\\') === false) {
$file = $this->migrationPath . DIRECTORY_SEPARATOR . $class . '.php';
require_once($file);
} elseif (!class_exists($class, false)) {
// detect aliases migration in global namespace
require_once(Yii::getAlias('@'.str_replace('\\', '/', $class)).'.php');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this step is done by the Yii autoloader in case you enable second parameter in class_exists, so it is not needed here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it would be

} elseif (!class_exists($class, true)) {
    $class = StringHelper::basename($class);
}

Copy link
Contributor Author

@schmunk42 schmunk42 Jan 11, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will update that if all concerns are sorted out.

@samdark
Copy link
Member

samdark commented Jan 10, 2017

Providing such fallback makes code to be risk prone.

Not really. Migration classes have very special names so it's unlikely that there will be a collision. Or do you mean another risk?

With this change migration applied via non-namespace fallback will be unable for revertion as there is no iteration over namespaces during this process.

Why? Current non-namespaced migrations are OK with reverting, aren't they?

You can configure it just once at console application config and then use always. Switching its value seems to be completely redundant work to me in such scope.

It is similar to ./yii message ability to use either config or options. One may want to write a shell script setting these options depending on various conditions.

You can refactor your migrations source code adding a namespace for them.
Then you can use yii migrate/mark command to clear the old migration history and then apply the new one containing namespaces.
It does not sounds so bad to me.

It is quite bad. First of all, some migrations may be irreversible and already applied. Then there are extensions providing non-namespaced migrations which you can't really modify yourself. At the same time there could be extensions w/ namespaced migrations.

@schmunk42
Copy link
Contributor Author

schmunk42 commented Jan 10, 2017

Converting namespaced classes to non-namespaced is inconsistent.

It is, I am not happy about that either.

Providing such fallback makes code to be risk prone.

How big is that risk really, since all migrations carry a name and a date-time-second?
There have been around 100 million seconds since the existance of Yii2 and there are around 5000 packages, not even modules for Yii2 - and we're talking only about legacy support here.

That's the reason why the syntax was chosen - now we have to live with this, somehow.

There is not one example showing that this has ever been a problem, even with Yii1 - but I am repeating myself. Saying this would be a greater risk than refactoring hundreds of files is simply not true.

Second concern is migration history ... With this change migration applied via non-namespace fallback will be unable for revertion as there is no iteration over namespaces during this process.

This has not to be a concern, since aliases and namespaces are both essentially paths, not taking the 1:100.000 chance from above into account, but that's all.

This has not been yet decided. There is no due date even for 2.1 milestone. And there is no final decision is migrationPath will be removed or not. In fact several years may pass before this matter will become today issue. I can see no reason to be worry

"Also BaseMigrateController::$migrationPath is considered as deprecated and will be removed in future versions. Why we should extend its functionality?" -- @klimov-paul a day ago

[removed paragraph] Sorry bad wording

You can refactor your migrations source code adding a namespace for them.

No, I can not, since we're using a lot of 3rd party extensions - which would have to be forked for this task, added manually to composer.json etc..., completely unfeasible.

Using of namespaces for migrations will make necessity of operating migrationPath obsolete.

[removed] Sorry bad wording

Using of namespaces for migrations will make necessity of operating migrationPath obsolete. All we need to do is just wait for extensions to pick up the improvement.

[removed] Sorry bad wording

You can declare migration classes twice: one namespaced with actual code and another one non-namespaced, which just extends it

[removed] Sorry bad wording

Yes, that's something to think about. I was thinking about registering different autoload paths for the global namespace (<- damn ugly). Maybe we can find a solution starting from here, I'd really like to.

@cebe
Copy link
Member

cebe commented Jan 10, 2017

@schmunk42 @klimov-paul maybe it is about time to take a break, get some fresh air or sleep and come back tomorrow with a calm mind? :)

@klimov-paul
Copy link
Member

klimov-paul commented Jan 10, 2017

Not really. Migration classes have very special names so it's unlikely that there will be a collision. Or do you mean another risk?

Program behavior should be consistent: in case you expect namespaced class - the namespaced class should be used, in case you are expecting non-namespaced class - non-namespaced class should appear.
Developer may forgot to add namespace operator at the migration class declaration by mistake. He should be notified about this mistake instead of silent fallback to non-namespaced class.

Why? Current non-namespaced migrations are OK with reverting, aren't they?

This has not to be a concern, since aliases and namespaces are both essentially paths, not taking the 1:100.000 chance from above into account, but that's all.

We are talking about fallback from namespaced class to non-namespaced one. The migration history will be broken: instead of some\module\migrations\M...Foo it will write up just M...Foo. Then when you run yii migrate/down it will search for M...Foo.php inside migrationPath, which value is app/migrations and obviosly will fail to find it and thus migration can not be reverted.

It is similar to ./yii message ability to use either config or options. One may want to write a shell script setting these options depending on various conditions.

I am not against exposing migrationNamespaces to the CLI interface. I just say I never considered it as necessary, but if will make you feel better - we can add it - I have no solid objections here.

It is quite bad. First of all, some migrations may be irreversible and already applied. Then there are extensions providing non-namespaced migrations which you can't really modify yourself. At the same time there could be extensions w/ namespaced migrations.

Pay attention: you should use migrate\mark not migrate\down! Mark command simply clears the migration history without execution of the migration code: no up() or down() methods will be ever called, no database changes expect the values in migration table will be performed.

"Also BaseMigrateController::$migrationPath is considered as deprecated and will be removed in future versions. Why we should extend its functionality?" -- @klimov-paul a day ago

Yes, but I have not said anything about it being removed tomorrow or at 2.1 release. 'Future' is a relative entity.

No, I can not, since we're using a lot of 3rd party extensions - which would have to be forked for this task, added manually to composer.json etc..., completely unfeasible.

Noone forces you to abandon exiting code - it will work jsut fine with current code.
Switching to namespaces is a long shot. I do not expect it to appear tomorrow and I do not understand why you do.
The newly created project may gain a benefit from it, existing one may migrate to them or stay with old implementation. I still can not see any problem here.

Please do not mix up 2 different terms: 'file path' and 'namespace' - they are not equal. File path can be calculated by namespace, however it is not always so. Each namespace has a file path related to it, but not every file path corresponds to some namespace.

We have chosen namespaces because they contain a file path, while being more flexible resolving more problems.

@cebe
Copy link
Member

cebe commented Jan 10, 2017

Switching to namespaces is a long shot.

Do we have documentation on how to adjust an existing migration history to the new, namespaced version? If not, we should create that.

@samdark
Copy link
Member

samdark commented Jan 10, 2017

Program behavior should be consistent

That is why I'm insisting this fallback to be optional and disabled by default. It's indeed could get cryptic to find out migration w/o namespace but it is essential if you have to support both at the same time.

We are talking about fallback from namespaced class to non-namespaced one. The migration history will be broken

For migrations applied using --migrationPath only and that's the same as it was before namespaces so we're not breaking more than it was. Migrations in the default path are still OK.

you should use migrate/mark not migrate/down

So:

  1. Use mark to remove migrations info from applied history.
  2. Introduce namespaces to all existing migrations.
  3. Use mark to add new migrations infor to applied history.

One thing. You can't use mark to get to state of no migrations applied.

@samdark
Copy link
Member

samdark commented Jan 10, 2017

@cebe no, we don't have it.

@schmunk42
Copy link
Contributor Author

schmunk42 commented Jan 11, 2017

He should be notified about this mistake instead of silent fallback to non-namespaced class.

He should even be forced to enable this setting.

We are talking about fallback from namespaced class to non-namespaced one. The migration history will be broken: instead of some\module\migrations\M...Foo it will write up just M...Foo.

Just save it with its alias.

Noone forces you to abandon exiting code - it will work jsut fine with current code.

That's fragmenting the framework as a whole, leaves old versions running forever - and therefore creates security problems.

I didn't respond to the migration mark things, cause they are completely unrelated and don't help in any way.

Please do not mix up 2 different terms: 'file path' and 'namespace' - they are not equal.

I am only talking about aliases and namespaces.

"An alias is automatically defined for each extension that is installed via Composer. Each alias is named after the root namespace of the extension as declared in its composer.json file, and each alias represents the root directory of the package. For example, if you install the yiisoft/yii2-jui extension, you will automatically have the alias @yii/jui defined during the bootstrapping stage,..."

http://www.yiiframework.com/doc-2.0/guide-concept-aliases.html#extension-aliases

That's the reason why everyone who is using multiple migrations, was using aliases for that. Because it was the closest, actually equivalent, match.

If it would have been possible to use namespaces in migrations or if it would have been recommended people would have done that.

We have chosen namespaces because they contain a file path, while being more flexible resolving more problems.

Which ones? Isolation is none.

@klimov-paul
Copy link
Member

klimov-paul commented Jan 11, 2017

I am only talking about aliases and namespaces.

'Path alias' and 'namespace' are different terms just as well as 'file path' and 'namespace'.
Most namespace has an path alias associated with them, this is valid for every yii2-extension composer package. However not every path alias has corresponding namespace. For example: there are @vendor, @runtime, @webroot and so on.
You may specify path to the same directory using different path aliases. For example following path aliases will lead to the same directory:

  • @some/extension/migrations
  • @vendor/some/extension/migrations

Which ones? Isolation is none.

While using PHP namespaces particual class can not belong to 2 different namespaces at the same time ever.

The fact that 'path alias' matches 'namespace' in some situation does not justify substitution of namespace by path alias.
Terms 'path alias' and 'namespace' are not equal, thus they can not substitute each other.

That's the reason why everyone who is using multiple migrations, was using aliases for that. Because it was the closest, actually equivalent, match.

Original usage of migrationPath at Yii2 is anachronism. While migrating code from Yii1 to Yii2 we have not reconsidered the migration source logic. File path should been converted to namespace back at 2.0.0 release. Now this mistake has been fixed up, so the future Yii2 based projects gain better migration support.

Creating a fallback from namespaced to non-namespaced class name is inconsistent from the programming point of view. Its only value is making people happy to use old walk-around they got used to.

I do not like the idea of putting inconsitent behavior inside the Yii core, even if has its own benefit (even sugnificant one). In this situation I would prefer modified MigrateCommand, with 'namespace to path alias' fallback, being released and maintained as a separated extension, which it is now already.

Anyway, I am in minority here, and my voice have a little value in this discussion. The rest of the core team are free to proceed with this PR as they consider best - I will not perform any attempts to stop them as it makes no sense.

@klimov-paul klimov-paul removed their assignment Jan 13, 2017
@schmunk42
Copy link
Contributor Author

However not every path alias has corresponding namespace. For example: there are @Vendor, @runtime, @webroot and so on.

That's not the point in this discussion, it's only about yii2-extensions from composer, all have corresponding aliases <-> namespaces.

Creating a fallback from namespaced to non-namespaced class name is inconsistent from the programming point of view. Its only value is making people happy to use old walk-around they got used to.

We're making a 6-digit turnover with Yii projects a year, I simply don't want to throw out a huge amount of money out of the window.

In this situation I would prefer modified MigrateCommand, with 'namespace to path alias' fallback, being released and maintained as a separated extension, which it is now already.

The reality is, that there are hundreds of projects using the alias system, because there was no other alternative. Aliases are 99% as-good-as-namespaces when it comes to migrations.

The current solution does only partially help the community and a decent support in the core would save 100s of work hours.

There were mistakes made, forget it! I agree to most programatically or technical statements you made. But what I say is about efficiency not philosophy.


One more thing, which might lead to a solution (don't know 100%).

I just tried this, I added namespace app\migrations; to some migrations in my app.
I thought they would not matter, since I am not using the new feature at all. But this also fails.

While this is also not technically 100% perfect, wouldn't it make sense to allow correct namespaces, even if we're still using migrationPath - this might lead to a much smoother transition.

@klimov-paul
Copy link
Member

Support for field migrationNamespaces setup from CLI added, since we agreed on it:
862a5dd

@cebe
Copy link
Member

cebe commented Jun 1, 2017

My proposal of solving this by allowing to use aliases in $migrationNamespaces: #14241
I hope this is more clear and a sane approach of solving this issue, as it does not confuse namespaces and alisases anymore. alisases are for specifying directories, namespaces for namespaces.
Closing this PR as the change is included in #14241.

@cebe cebe closed this Jun 1, 2017
cebe pushed a commit to cebe/yii2 that referenced this pull request Jun 2, 2017
mixartemev added a commit to mixartemev/yii2 that referenced this pull request Jun 24, 2017
* Fixes yiisoft#13945: Removed Courier New from error page fonts list since it looks bad on Linux (yiisoft#13947)

* Fixed phpdoc broken links to PHP manual pages [skip ci]

* Fixes yiisoft#10675: Added docs for disabling CSRF validation in standalone actions

* updated docs for base64UrlEncode()

as discussed in
yiisoft#13411 (comment)

* Fix `\yii\db\QueryTrait` type hints (yiisoft#13956) [skip ci]

* Fix `\yii\db\QueryInterface` type hints (yiisoft#13959) [skip ci]

* Added missing parts of disabling CSRF validation doc [skip ci] (yiisoft#13966)

* Fixed wording in Russian translation (yiisoft#13970) [skip ci]

* Fixes yiisoft#13961: RBAC Rules: PostgreSQL: PHP Warning "unserialize() expects parameter 1 to be string, resource given" was fixed

* compatibility for PHPUnit adjusted

* compatibility with PHPUnit 6.x added

* unit test fix

* `yii\caching\Cache::getOrSet()` now supports both `Closure` and `callable`

Closes yiisoft#13981

* compatibility with PHPUnit 6.x fix

* garbage collection added to unit tests

* compatibility with PHPUnit 6.x fix

* fixed tests without assettions

* compatibility with PHPUnit 6.x fix

* compatibility with PHPUnit 6.x fix

* memory usage at unit test reduced

* update phpdoc annotation in BaseActiveRecord

yiisoft/yii2-gii#267 (comment)

* added upgrade note about yii\cache\Cache::getOrSet()

* Revert "update phpdoc annotation in BaseActiveRecord"

This reverts commit 0f78008.

yiisoft/yii2-gii#267 (comment)

* Tweaked verbiage slightly [ci skip]

* yiisoft#13975: make documentation of current behaviour more clear [skip ci]

* docs/guide/input-multiple-models: added a note on avoiding validating the same input data with the same rules more than once (yiisoft#13995) [skip ci]

* Fixes yiisoft#13807: Fixed `yii\db\QueryBuilder` to inherit subquery params when building a `INSERT INTO ... SELECT` query

* Tiny documentation fix [skip ci] (yiisoft#13998)

* Added note to findOne and findAll docs (yiisoft#14002) [skip ci]

Added note to findOne and findAll docs to clearly state that complex conditions are not supported.

* [IpValidator] disable ipv6 checks (yiisoft#13984)

* disable ipv6 checks

* remove empty line

* updated CHANGELOG.md

* Added AF_INET6 to requirements

* Enhanced requirements memo for IPv6

* update AR docs

* Update composer fxp plugin version in docs and travis scripts

* Fixes yiisoft#13963: Added tests for yii\behaviors\TimestampBehavior

* Fixes yiisoft#13911: Significantly enhanced MSSQL schema reading performance

* Skipped segfaulting test when running on Travis and corresponding PHP versions

* enforce `backupGlobals` enabled for PHPUnit

* Fix `TimestampBehaviorTest` to be compatible with PHPUnit 6

* Switched to asset-packagist

* Enable xdebug for coverage on 7.1 insted of 5.6 as it should work faster

* Switched ocular to use PHP 7.1 execution results

* Added note clarifying that load function clears fixture data [skip ci]

* Fixes yiisoft#13728: Fixed the bug when `yii\behaviors\SluggableBehavior` wasn't preserving immutable slug values

* Changed return value in MemCache::setValues()

* Fixes yiisoft#13362: Fixed return value of

* Fixes yiisoft#14012: `yii\db\pgsql\Schema::findViewNames()` was skipping materialized views

* Created issue template

* Wrong repo [skip ci]

* Fixes yiisoft#13694: yii\widgets\Pjax now sends X-Pjax-Url header with response to fix redirect

* Fixed PHP manual link language [skip ci]

* Add setup for Apache

Describes the settings for Apache.

* yii\filters\RateLimiter refactored (yiisoft#13994)

Refactored yii\filters\RateLimiter and added tests

* Fixed spelling and typos

* Updated slovak localization

Fixed missing translation for '{attribute} must be an integer.' string

* Fixed ignored params when using count in `SqlDataProvider`

*  Fixed ambiguous error sql while using unique validator

* Refactored solution to be contained within ActiveQuery instead of helper

* Removed unneeded changelog line [skip ci]

* Removed obsolete import

* improve session PHPdoc

* Applied disambiguation to ExistValidator as well

* Fixes yiisoft#10346: Fixed "DOMException: Invalid Character Error" in `yii\web\XmlResponseFormatter::buildXml()`

* Fixes yiisoft#13087: Fixed getting active validators for safe attribute

* Added `yii\data\Sort::parseSortParams`

allowing customize other params request formats in descendant class.

close yiisoft#13170

* Fixes yiisoft#11719: Fixed `yii\db\Connection::$enableQueryCache` caused infinite loop when the same connection was used for `yii\caching\DbCache`

* Adjusted code style for less conditions branching

* Fixes yiisoft#13226: `yii cache` command now warns about the fact that it's not able to flush APC cache from console

* Fixes yiisoft#13848: `yii\di\Instance::ensure()` wasn't throwing an exception when `$type` is specified and `$reference` object isn't instance of `$type`

* Fixes yiisoft#13689: Fixed handling of errors in closures

* Fixed changelog [skip ci]

* PHPDocs and code style fixed

* Helper independent (yiisoft#14050)

* Made sure most helpers are independent of Yii::$app

* Made sure most validators are independent of Yii::$app

* Fixes yiisoft#14033: Fixed `yii\filters\AccessRule::matchIp()` erroring in case IP is not defined under HHVM

* Removed redundant use

* Removed redundant else

* param → parameter [skip ci]

* Adjusted changelog [skip ci]

* Update runtime-routing.md

* Fixes yiisoft#13790: Fixed error in `\yii\widgets\MaskedInput` JavaScript by raising version required

* Fixes yiisoft#14052: Fixed processing parse errors on PHP 7 since these are instances of `\ParseError`

* Fixes yiisoft#13951: renamed get-method which was conflicting with existing property (yiisoft#14055)

* Alternative names

* Fixes yiisoft#14059: Removed unused AR instantiating for calling of static methods

* Add phpdoc. [skip ci]

* Fix an invalid phpDocumentor annotation

Fixed an invalid phpDocumentor annotation of `yii\data\DataProviderInterface::getPagination()`.

* Fixes yiisoft#14072: clear table schema cache for all methods that affect cache

* Reorder changelog

* file will not loaded

https://github.com/yiisoft/yii2/tree/master/framework/test

* Fix validators documentation

* More control over ActiveForm widget

If part of a form is rendered separately (e.g. in ajax request), it's not easy to apply JS validation to it.
By moving JS registration to a separate method this problem could be solved much more easier.

* Renamed `ActiveForm::registerJs()` to `registerClientScript()`, added tests

* Fixed tests

* Fixed CHANGELOG

* Reordered CHANGELOG

* fixed missing changelog and missing `@since`

* Skip testAutoRefreshTableSchema on sqllite

* Skip just certain things for sqllite

* !==

* Update phpdoc, \yii\db\ActiveRecord => \yii\db\ActiveRecordInterface [skip ci] (yiisoft#14076)

* Cleanup after yiisoft#14017 (yiisoft#14091)

* Fixed Oracle SQL queries with `IN` condition and more than 1000 parameters

* Updated PHPdoc

* Remove unused imports. (yiisoft#14096)

* Fixes yiisoft#4793: `yii\filters\AccessControl` now can be used without `user` component

* Fixes yiisoft#14098: `yii\helpers\BaseFileHelper::normalizeOptions()` is now protected

* Fixes yiisoft#14108: fixed phpdoc mistake in method description

* Update db-migrations.md (yiisoft#14109) [skip ci]

By default, the class BaseMigrateController property migrationPath is assigned the value '@app/migrations'. In the method getNewMigrations() is the conversion migrationNamescpaces in the path to the file and merges it all into a single array along with the path migrationPath. If the project for migration module is a separate table in the database, all migration came from migrationPath are not initialized and therefore try to migrate. Therefore, it is necessary to specify the property 'migrationPath' => null.

* Eliminated else branches in beforeSave() and beforeDelete() phpdoc examples [skip ci]

* Fixes yiisoft#13890: DbTarget log transaction bug

* Update db-migrations.md (yiisoft#14113) [skip ci]

I made a typo. Sorry. The command migration-rbac, migrationPath property already exists.

* Typo (yiisoft#14117) [skip ci]

* Add Indonesian guide translation (yiisoft#14120) [skip ci]

* Update README.md on Indonesian Guide Translation

* Translate "Working with Forms" guide to Bahasa Indonesia

* added option to disable query logging in DB command

fixes yiisoft#12528

* moved query log logic into private method and reduced calls to getRawSql()

fixes yiisoft#12528

* failing test for asset bundle publishing empty directories

* Added copyEmptyDirectories option to FileHelper

also set it to false in AssetManager to avoid creating a lot of empty
directories.

fixes yiisoft#9669

* made AssetBundle tests less cryptic

cleanup step was added in setUp() so this will still work.

split test functions filehelper test

* Fixes yiisoft#5442: Fixed problem on load fixture dependencies with database related tests

* Fixed changelog [skip ci]

* Added support for sorting by expression to `\yii\data\Sort`

* function clear() -- Set populated arrays to empty arrays (yiisoft#14067)

`yii\web\View::clear()` sets populated arrays to empty arrays

* changelog for yiisoft#14067

* Further changes for unique and exist validators

- Combined methods for getting names and aliases of from tables
- Normalized names and aliases
- Added MSSQL syntax
- Added support for spaces in aliases and table names

* added changelog for yiisoft#12528

* Do not render empty row in GridView when data is empty and emptyText set to false

Fixes yiisoft#13352
close yiisoft#13422

* Added support for cloning a db connection

improved fix yiisoft#14020
fixes yiisoft#13890

https://github.com/yiisoft/yii2/pull/14020/files#r115185865

close yiisoft#14121

* Fixed ambiguous column name in SELECT in UniqueValidator

fixes yiisoft#14042

* Added escaping for column name

* Fixes yiisoft#13350, yiisoft#14094, yiisoft#11288

- Bug yiisoft#13350: Fixed bug with incorrect caching of `yii\web\UrlRule::createUrl()` results in `yii\web\UrlManager`.
- Bug yiisoft#14094: Fixed bug when single `yii\web\UrlManager::createUrl()` call my result multiple calls of `yii\web\UrlRule::createUrl()` for the same rule.
- Enh yiisoft#11288: Added support for caching of `yii\web\UrlRule::createUrl()` results in `yii\web\UrlManager` for rules with defaults.

* Remove unnecessary variable from UrlRule.php (yiisoft#13948)

* Additional refactoring as suggested by @dynasource

* fix broken link (yiisoft#14143) [skip ci]

File output-client-scripts.md not created. And in site - error 404: http://stuff.cebe.cc/yii2docs-ru/guide-output-client-scripts.html

* "из вне" => "извне"

grammar nazi attack

* Fixed changelog [skip ci]

* Fixes yiisoft#14133: Fixed bug when calculating timings with mixed nested profile begin and end in `yii\log\Logger::calculateTimings()`

* Fixes yiisoft#14150

* Translate "Working with Database" guide to Bahasa Indonesia (yiisoft#14152) [skip ci]

* yiisoft#14150: Added {{ and }} to getTablesUsedInFrom() output

* Additional edge case for yiisoft#14150

* Translate "Generating Code with Gii" guide to Bahasa Indonesia (yiisoft#14162)

* Fixes yiisoft#14161, yiisoft#14150: fixed primary table aliasing (include case manual set alias) in validators

* added namespace example to the autoload guide

* Translate "Looking Ahead" guide to Bahasa Indonesia (yiisoft#14177)

* advanced example on filter validator

fixes yiisoft#4284

* Simplified Chinese translation of filter validator (yiisoft#14195)

* Simplified Chinese Translation of filter validator

* Using more specific words

* Fixed typo in BaseFileHelper::findFiles() docs (yiisoft#14200) [skip ci]

* Add test coverage of yii\helpers\BaseArrayHelper (yiisoft#14205)

* Translate some application structure guide to Bahasa Indonesia (yiisoft#14209) [skip ci]

* Add blocktypes.json file in Indonesian Guide

* Translate "Application Structure Overview" to Bahasa Indonesia

* Translate "Entry Script" guide to Bahasa Indonesia

* Translate "Structure App - Application" to Bahasa Indonesia

* Translate "Application Component" guide to Bahasa Indonesia

* Add translators.json attribution in Indonesian Documentation

* Fixes yiisoft#14211: Fixed regression in Unique and Exist validators

* fixed indonesian translators.json file

* add doc for issue yiisoft#8420
yiisoft#8420

* typo

* Adjusted text [skip ci]

* MySql -> MySQL typo

* Adjusted typo text [skip ci]

* Fixes yiisoft#13846: Fixed `Query::count()` issue with `orderBy`

* Inserted missing * on line 972 (yiisoft#14224) [skip ci]

* Add test coverage of yii\helpers\BaseMarkdown (yiisoft#14223)

* Add test coverage of yii\helpers\BaseJson (yiisoft#14217)

* Adjusted text [skip ci]

* Adjusted text [skip ci]

* Adjusted text [skip ci]

* Adjusted text [skip ci]

* Add test coverage of yii\helpers\Html (yiisoft#14220)

* Add migration file example for DbSession (yiisoft#14227) [skip ci]

Creating a `char` primaryKey in a migration is non-obvious. Used solution from this [issue comment](yiisoft#10889 (comment)).

* Adjusted text [skip ci]

* Fixed yiisoft#13551: loading fixtures in subdirectories

* Enhanced FixtureController::getFixtureRelativeName()

Updated CHANGELOG

* Adjusted text,add some adivse [skip ci]

* Alternative implementation for passing parameters to AccessRule roles

fixes yiisoft#8426: `yii\filters\AccessRule` now allows passing GET or other parameters to the role checking function
replaces yiisoft#8426

* Document queryParams in the authorization guide

* simplified guide example

* improved docs

* Fixed RBAC databases tests

tests were reusing static DB connection instance resulting in all tests
to be run against MySQL only!

PgSQL and Sqlite tests are now failing because of the issue reported in yiisoft#13501.

* added failing test for yiisoft#13593

* additional fix for yiisoft#13501

close yiisoft#13593

* fix cloning of DB connection for sqlite in-memory db

fixes yiisoft#14131
close yiisoft#14232

* Allows override query relation in descendant class

fixes yiisoft#13441
close yiisoft#13642

* Fixes yiisoft#13058: Fixed caught exception thrown during view file rendering produces wrong output

* improved docs: link term "path alias" to the guide

* Added support for specifying aliases for migrationNamespaces

This is used to specify pathes to migrations that do not have
namespaces.

While not directly supported by the migration command provideded by the
framework, these migrations exist in a lot of extensions because custom implementations
of migration controllers out of the framework were using this approach
to load multiple migrations from multiple paths.

Even the framework itself currently ships non-namespaced migrations:

- https://github.com/yiisoft/yii2/blob/17a1d91e4a517f4f15dce973bf3c50dd939dce63/framework/rbac/migrations/m140506_102106_rbac_init.php
- https://github.com/yiisoft/yii2/blob/17a1d91e4a517f4f15dce973bf3c50dd939dce63/framework/caching/migrations/m150909_153426_cache_init.php
- https://github.com/yiisoft/yii2/blob/17a1d91e4a517f4f15dce973bf3c50dd939dce63/framework/log/migrations/m141106_185632_log_init.php

This change allows existing applications to adopt the new namespace-based approach
while keeping existing migrations. While it would be possible to add
namespaces to migrations in the application itself, it is not easily possible
to add namespaces to migrations that come from external sources like
extensions.

* added alias syntax support

fixes yiisoft#13356
fixes yiisoft#13359

* make migrationPath accept an array

* moved include file logic to separate method

* Fixes yiisoft#4999: Added support for wildcards at `yii\filters\AccessRule::$controllers`

* Update BaseMigrateController.php

make sure console arguments are recognized as array.

* Fixes yiisoft#5108 `DateValidator` resets `$timestampAttribute` value on empty attribute (yiisoft#14242)

* `yii\validators\DateValidator` now resets `$timestampAttribute` value on empty validated attribute value

* array-value test at `DateValidatorTest` restored

* skip failing HHVM test

see yiisoft#14244

* moved wrong changelog entry

* fixed version and missing `@since` annotation

* release version 2.0.12

* prepare for next release

* Greek translation update.

* Fixed Formatter::normalizeDatetimeValue() docs

There was a reference to `$checkTimeInfo` that was leftover from 54278fc

* improved formatter documentation

* Fix MessageController color output on non-color termnials

fixes yiisoft#14248
close yiisoft#14249

* guide: note about param binding on strings, not arrays

issue yiisoft#14218

* added param binding examples for update() and delete()

fixes yiisoft#14218

* Fixes yiisoft#14264: Fixed a bug where `yii\log\Logger::calculateTimings()` was not accepting messages with array tokens

* Improved base migration controller documentation [skip ci] (yiisoft#14253)

* added example for using unsupported PHP format in yii formatter

fixes yiisoft#14278

* Fixes yiisoft#14201: `yii\console\controllers\MessageController::extractMessagesFromTokens()` is now protected

* Fixes yiisoft#13787: Added `yii\db\Migration::$maxSqlOutputLength` that allows limiting number of characters for outputting SQL

* Adjusted RBAC docs to offer both migrations and command approaches [skip ci]

* Fixes yiisoft#14089: Added tests for `yii\base\Theme`

* Fixes yiisoft#13586: Added `$preserveNonEmptyValues` property to the `yii\behaviors\AttributeBehavior`

* Fixes yiisoft#14192: Fixed wrong default null value for TIMESTAMP when using PostgreSQL

* Fixes yiisoft#14081: Added `yii\caching\CacheInterface` to make custom cache extensions adoption easier

* Removed unused local var in JS test (yiisoft#14093)

* Added php-cs-fixer coding standards validation to Travis CI (yiisoft#14100)

* php-cs-fixer: PSR2 rule.

* php-cs-fixer: PSR2 rule - fix views.

* Travis setup refactoring.

* Add php-cs-fixer to travis cs tests.

* Fix tests on hhvm-3.12

* improve travis config

* composer update

* revert composer update

* improve travis config

* Fix CS.

* Extract config to separate classes.

* Extract config to separate classes.

* Add file header.

* Force short array syntax.

* binary_operator_spaces fixer

* Fix broken tests

* cast_spaces fixer

* concat_space fixer

* dir_constant fixer

* ereg_to_preg fixer

* function_typehint_space fixer

* hash_to_slash_comment fixer

* is_null fixer

* linebreak_after_opening_tag fixer

* lowercase_cast fixer

* magic_constant_casing fixer

* modernize_types_casting fixer

* native_function_casing fixer

* new_with_braces fixer

* no_alias_functions fixer

* no_blank_lines_after_class_opening fixer

* no_blank_lines_after_phpdoc fixer

* no_empty_comment fixer

* no_empty_phpdoc fixer

* no_empty_statement fixer

* no_extra_consecutive_blank_lines fixer

* no_leading_import_slash fixer

* no_leading_namespace_whitespace fixer

* no_mixed_echo_print fixer

* no_multiline_whitespace_around_double_arrow fixer

* no_multiline_whitespace_before_semicolons fixer

* no_php4_constructor fixer

* no_short_bool_cast fixer

* no_singleline_whitespace_before_semicolons fixer

* no_spaces_around_offset fixer

* no_trailing_comma_in_list_call fixer

* no_trailing_comma_in_singleline_array fixer

* no_unneeded_control_parentheses fixer

* no_unused_imports fixer

* no_useless_return fixer

* no_whitespace_before_comma_in_array fixer

* no_whitespace_in_blank_line fixer

* not_operator_with_successor_space fixer

* object_operator_without_whitespace fixer

* ordered_imports fixer

* php_unit_construct fixer

* php_unit_dedicate_assert fixer

* php_unit_fqcn_annotation fixer

* phpdoc_indent fixer

* phpdoc_no_access fixer

* phpdoc_no_empty_return fixer

* phpdoc_no_package fixer

* phpdoc_no_useless_inheritdoc fixer

* Fix broken tests

* phpdoc_return_self_reference fixer

* phpdoc_single_line_var_spacing fixer

* phpdoc_single_line_var_spacing fixer

* phpdoc_to_comment fixer

* phpdoc_trim fixer

* phpdoc_var_without_name fixer

* psr4 fixer

* self_accessor fixer

* short_scalar_cast fixer

* single_blank_line_before_namespace fixer

* single_quote fixer

* standardize_not_equals fixer

* ternary_operator_spaces fixer

* trailing_comma_in_multiline_array fixer

* trim_array_spaces fixer

* protected_to_private fixer

* unary_operator_spaces fixer

* whitespace_after_comma_in_array fixer

* `parent::setRules()` -> `$this->setRules()`

* blank_line_after_opening_tag fixer

* Update finder config.

* Revert changes for YiiRequirementChecker.

* Fix array formatting.

* Add missing import.

* Fix CS for new code merged from master.

* Fix some indentation issues.

* ensure tablenames are not replaced in insert and update

* Fixes yiisoft#14286: Used primary inputmask package name instead of an alias

* Documented possibility of using asset-packagist

* fixed typo

* Fixes yiisoft#14307: Fixed PHP warning when `yii\console\UnknownCommandException` is thrown for empty command

* Fixed phpdoc `yii\test\ActiveFixture::load` (yiisoft#14292) [skip ci]

* Fixes yiisoft#13824: Support extracting concatenated strings in `yii message`

* Fixes yiisoft#14298: The default response formatter configs defined by `yii\web\Response::defaultFormatters()` now use the array syntax

* Added link to Russian Sphinx guide [skip ci]

* Removed cs fixer from Travis

* Fixed typo [skip ci]

* Fixes yiisoft#14341: Fixed regression in error handling introduced by fixing yiisoft#14264
@schmunk42 schmunk42 deleted the master-c branch September 14, 2017 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:to be verified Needs to be reproduced and validated. status:under discussion
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants