-
Notifications
You must be signed in to change notification settings - Fork 892
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
Move migrations under the Phinx\Migration namespace #168
Comments
Need to do a much better job of this. Tasks
|
Maybe in 1.0 tag?! We broken compatibility in 1.0 release, no need much code to still work.... |
@felipedjinn yes I think it will need to wait until 1.0 or 1.5. will break too much BC. |
@robmorgan In my mind, the ideal would allow arbitrary namespaces, either specified in the config and imported into the default template, or defined on a migration-by-migration basis, so that we can arrange the migrations in whichever directory/namespace structure makes sense for our application. |
If you go as @cyrusboadway suggests and allow a namespace to be specified in the config, then that will allow each project to put the migrations in their own vendor namespace and still preserve existing projects using the global namespace. New projects could default to Phinx\Migration . It would then become a backwards-compatible change. Basically:
|
That's exactly what I'm looking for. Any update on the issue? |
I switched to Phinx from native framework migrations (I'm using Yii2) just to give it a try and see it in action. But this is for now is one of the biggest disadvantages for me. Any update on this? I want namespace to be |
Some random thoughts. The namespace will have to be added as a PSR-4 surely?
The namespace will also need to be injected into the template so that custom templates and custom template generators will have the option of using the default namespace or not. |
@rquadling +1 |
Would be great to do the same for Seeds :) |
Also namespaces should be different per path. Currently we have single path and it's possible to use single namespace per this path in future. But if we will use glob in path then we force to use same namespace everywhere. May be implement class loading in another way? Let it parse migration and use class name from parsed file. I think https://github.com/nikic/PHP-Parser will do the job easily. And it will not be backward breaker. |
#168 (comment) makes most sense, |
Is this ticket still valid? |
Looks like this has been done. |
@dereuromark to me it seems it was commited and then reverted: so what exactly is done? please point to pull-request or commit. |
@rquadling It's a PSR-2 issue because a PHP file without a namespace is not PSR-2 compliant. My deployment script checks my codebase for conformance to PSR-2. The migrations are currently breaking that. |
Maybe we should allow for project namespaces here |
For proper psr2 we also need to make the class names match the filenames.
instead of
|
Please allow custom namespaces like Everything should be fine then. Even a migration suffix should be possible then - like @dereuromark suggested. |
We should check this for next major - 0.13 release. |
In order to stop polluting the global namespace we will move migration classes under the
Phinx\Migration
namespace. This also conforms to PSR-2.The text was updated successfully, but these errors were encountered: