Symfony 2.4.2 composer Migrations bundle - php

I'm trying out Symfony but I'm running into some problems after I decided I wan't to test Migrations.
From the docs I learn I have to add this to the composer json.
"doctrine/doctrine-migrations-bundle": "dev-master",
So this is what I have now:
"require": {
"php": ">=5.3.3",
"symfony/symfony": "~2.4",
"doctrine/orm": "~2.2,>=2.2.3",
"doctrine/doctrine-bundle": "~1.2",
"doctrine/doctrine-migrations-bundle": "dev-master",
"twig/extensions": "~1.0",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~2.3",
"sensio/framework-extra-bundle": "~3.0",
"sensio/generator-bundle": "~2.3",
"incenteev/composer-parameter-handler": "~2.0"
},
But this isn't working. It cannot find the right version.
This is the error:
Problem 1
- Installation request for doctrine/doctrine-migrations-bundle dev-master -> satisfiable by doctrine/doctrine-migrations-bundle[dev-master].
- doctrine/doctrine-migrations-bundle dev-master requires doctrine/migrations * -> no matching package found.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion for more details.
After this and a lot of googling (https://github.com/doctrine/DoctrineMigrationsBundle/issues/54) and trying I tried to set the version for "doctrine/doctrine-bundle": "~1.2", to require the aplha version. This did continue the installation but introduces a new problem.
After adding this line to the app kernel into the $bundles array:
new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
I try to run this in the terminal: php app/console doctrine:migrations:status
But it gives me the following error:
Fatal error: Class 'Doctrine\DBAL\Migrations\Tools\Console\Command\LatestCommand' not found in /Applications/MAMP/htdocs/symfony/vendor/doctrine/doctrine-migrations-bundle/Doctrine/Bundle/MigrationsBundle/Command/MigrationsLatestDoctrineCommand.php on line 30
Right now I really don't know what I'm missing. I have no clue how to get this working. I hope someone can give me a push in the right direction! Thanks!

If you want to install the doctrine/doctrine-migrations-bundle you are also required to install doctrine/migrations. Based on your copy/paste of you composer.json, you forgot to add it.
Try with the following :
"require": {
"php": ">=5.3.3",
"symfony/symfony": "~2.4",
"doctrine/orm": "~2.2,>=2.2.3",
"doctrine/doctrine-bundle": "~1.2",
"doctrine/migrations" : "dev-master",
"doctrine/doctrine-migrations-bundle" : "dev-master",
"twig/extensions": "~1.0",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~2.3",
"sensio/framework-extra-bundle": "~3.0",
"sensio/generator-bundle": "~2.3",
"incenteev/composer-parameter-handler": "~2.0"
},
You are getting this error :
Fatal error: Class 'Doctrine\DBAL\Migrations\Tools\Console\Command\LatestCommand' not found in /Applications/MAMP/htdocs/symfony/vendor/doctrine/doctrine-migrations-bundle/Doctrine/Bundle/MigrationsBundle/Command/MigrationsLatestDoctrineCommand.php on line 30
because doctrine/migrations has not been downloaded and several classes are missing for the doctrine/doctrine-migrations-bundle.

You should check https://packagist.org/packages/doctrine/doctrine-migrations-bundle and try installing the latest version. Specifying more exact versions is better for overall stability as a composer update that gets the most up to date packages may have cause and effect on the stability of your application.

Related

update symfony 2.8 to 3.* , sonata errors

i would like update my symfony projet ( current 2.8 to sf 3.* )
this is my composer.json file ( requiere part )
"require": {
"php": ">=5.3.9",
"symfony/symfony": "2.8.*",
"doctrine/orm": "^2.4.8",
"doctrine/doctrine-bundle": "~1.4",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~4.0",
"sensio/framework-extra-bundle": "^3.0.2",
"incenteev/composer-parameter-handler": "~2.0",
"sonata-project/media-bundle": "^2.3",
"sonata-project/user-bundle": "^2.2",
"sonata-project/formatter-bundle": "~2.3",
"sonata-project/doctrine-orm-admin-bundle": "~2.2",
"sonata-project/admin-bundle": "~2.2",
"sonata-project/timeline-bundle": "^2.2",
"sonata-project/intl-bundle": "^2.2",
"sonata-project/cache-bundle": "^2.2",
"liuggio/excelbundle": "^2.0",
"friendsofsymfony/elastica-bundle": "^3.1",
"liip/imagine-bundle": "^1.4",
"friendsofsymfony/jsrouting-bundle": "^1.6",
"gos/web-socket-bundle": "^1.8"
},
If i change
"symfony/symfony": "2.8.*",
to
"symfony/symfony": "~3.0",
and do
php composer.phar update symfony/symfony --with-dependencies
but i have this error
Problem 1
- sonata-project/media-bundle 2.3.4 requires symfony/symfony ~2.3 -> satisfiable by symfony/symfony
So i tried to update media-bundle to 3.10.1 but it give me an error in another sonata bundle ..
how should I do things right?
I have to update the modules one by one?
or update my composer.json with all modifications ?
thanks
Your sonata dependencies are very too old and does not support Symfony 3.
Sample: https://github.com/sonata-project/SonataMediaBundle/blob/2.x/composer.json
You must upgrade your dependencies to make it working.
Also, you can use the composer why-not command to get more help.
I also got stuck in this error a few times. The error message is kinda abstract.
To solve this error you need to update the version for sonata-project/media-bundle in your composer.json file.
So you can replace it with: "sonata-project/media-bundle": "^3.1",
Then run composer update command again. You might get the same error you got above but for another package. Update that as well. Repeat this until your composer update command is successful.
At that point, if you are lucky your application will work. If not you need to update the code to use the new package version code. Remember, updating the first number of a package (from 2.8 to 3.something) means that is a breaking compatibility update.
Later update: if you check the composer.json file of sonata-project/media-bundle version 2.3 here: https://github.com/sonata-project/SonataMediaBundle/blob/2.3.0/composer.json you will see that it requires symfony version: "symfony/symfony": "~2.3" and you want to update to symfony version 3.something. So they are incompatible. That's why you also need to update this package and so on. Composer will do this behind the scenes and throw that error when your packages or their dependencies are not compatible between them.
Hope that helps.

Installing sonata ecommerce bundle

I need to use sonata e commerce capabilities in my project but I have't had any success so far. It seems that there is not a compatible version with my current setup.
Here is my composer file
"require": {
"php": ">=5.3",
"ext-soap": "*",
"ext-gd": "*",
"symfony/symfony": "2.8.*",
"doctrine/orm": "^2.4.8",
"doctrine/doctrine-bundle": "~1.4",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~5.0",
"sensio/framework-extra-bundle": "^3.0.2",
"incenteev/composer-parameter-handler": "~2.0",
"knplabs/knp-last-tweets-bundle": "*",
"friendsofsymfony/rest-bundle":"^1.8",
"twig/extensions":"1.2",
"friendsofsymfony/oauth-server-bundle": "dev-master",
"hwi/oauth-bundle": "^0.4.2",
"sonata-project/admin-bundle": "2.x.dev",
"sonata-project/doctrine-orm-admin-bundle": "2.x.dev",
"sonata-project/media-bundle": "~2.3",
"sonata-project/classification-bundle": "2.x-dev",
"sonata-project/user-bundle": "2.x.dev",
"sonata-project/block-bundle": "2.2.*"
},
When I run composer require sonata-project/ecommerce-bundle composer cant find a version that works with my current setup.
The error message that I get is
Problem 1
- Installation request for sonata-project/ecommerce ^2.0 -> satisfiable by sonata-project/ecommerce[2.0.0].
- sonata-project/ecommerce 2.0.0 requires sonata-project/block-bundle ^3.0 -> satisfiable by sonata-project/block-bundle[3.0.0, 3.0.1, 3.1.0, 3.1.1, 3.x-dev] but these conflict with your requirements or minimum-stability.
Please help. I have more than 3 days trying to get this working.
Some issues are going to be fixed when this PR is merged: https://github.com/sonata-project/sandbox/pull/583
So just wait a few days, or patch some code ;)

dependency hell: installing Sonata User

G'day all, I'm afraid yet another newbie is stuck trying to glue all the bits together. It's rather frustrating, to say the least :(
I've searched these forums, and see countless possible solutions, but none have worked so far. Most also also quite old, and versions have moved on.
Here we go:
https://sonata-project.org/bundles/user/2-2/doc/reference/installation.html
When I try this: composer require sonata-project/easy-extends-bundle
I get this:
Using version ^2.1 for sonata-project/easy-extends-bundle
./composer.json has been updated Loading composer repositories with
package information Updating dependencies (including require-dev) Your
requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package sonata-project/admin-bundle == 2.3.7.0 could not be found. Problem 2
- Can only install one of: sonata-project/block-bundle[2.3.8, 2.2.13].
- Can only install one of: sonata-project/block-bundle[2.3.8, 2.2.13].
- Can only install one of: sonata-project/block-bundle[2.3.8, 2.2.13].
- sonata-project/admin-bundle dev-master requires sonata-project/block-bundle ^2.3.8 -> satisfiable by
sonata-project/block-bundle[2.3.8].
- Installation request for sonata-project/admin-bundle dev-master -> satisfiable by sonata-project/admin-bundle[dev-master].
- Installation request for sonata-project/block-bundle == 2.2.13.0 -> satisfiable by sonata-project/block-bundle[2.2.13].
Potential causes:- A typo in the package name - The
package is not available in a stable-enough version according to your
minimum-stability setting
Installation failed, reverting ./composer.json to its original
content.
I'm just following instructions, plain and simple! I read those articles, and tried a few solutions here, and via a Google search.
For what it's worth, I'm an old Unix hacker from way back, and I don't remember open source builds being this hard ...
Any clues? Many thanks in advance!
p.s. I'm using a Debian virtual box, as I thought it'd be easier than trying things on my Windows 8 PC.
Here is the only changed section from composer.json:
"require": {
"php": ">=5.3.9",
"symfony/symfony": "2.7.*",
"doctrine/orm": "~2.2,>=2.2.3,<2.5",
"doctrine/dbal": "<2.5",
"doctrine/doctrine-bundle": "~1.4",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~4.0",
"sensio/framework-extra-bundle": "~3.0,>=3.0.2",
"incenteev/composer-parameter-handler": "~2.0",
"friendsofsymfony/user-bundle": "~2.0#dev",
"sonata-project/admin-bundle": "2.3.*",
"sonata-project/doctrine-orm-admin-bundle": "^2.3",
"sonata-project/easy-extends-bundle": "^2.1",
"sonata-project/user-bundle": "^2.2",
"sonata-project/easy-extends-bundle": "dev-master"
},
1. Empty the vendor folder: Delete everything on it, but don't delete itself. Maybe a broken downloaded dependency is causing you issues.
2. Replace your require section of your composer.json with this one:
"require": {
"php": ">=5.3.9",
"symfony/symfony": "2.7.*",
"doctrine/orm": "~2.2,>=2.2.3,<2.5",
"doctrine/dbal": "<2.5",
"doctrine/doctrine-bundle": "~1.4",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~4.0",
"sensio/framework-extra-bundle": "~3.0,>=3.0.2",
"incenteev/composer-parameter-handler": "~2.0",
"friendsofsymfony/user-bundle": "~1.3",
"sonata-project/admin-bundle": "2.3.*",
"sonata-project/doctrine-orm-admin-bundle": "^2.3",
"sonata-project/easy-extends-bundle": "^2.1",
"sonata-project/user-bundle": "^2.2"
},
Notice the difference about "friendsofsymfony/user-bundle" version.
Now it should work! Let me know if it's still causing you issues.

install sonata ecommerce ERROR

I'm trying to install sonata in my symfony project.
I my composer.jso I add:
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.6.*",
"doctrine/orm": "~2.2,>=2.2.3",
"doctrine/doctrine-bundle": "~1.2",
"twig/extensions": "~1.0",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~3.0",
"sensio/framework-extra-bundle": "~3.0",
"incenteev/composer-parameter-handler": "~2.0",
"genemu/form-bundle": "2.2.*",
"sonata-project/ecommerce": "2.3#dev"
},
I do next the command: composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package sonata-project/ecommerce could not be found in any version, there may be a typo in the package name.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.
Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
Someboy knows why?
Thanks
Best regards
Try this in your composer.json :
"sonata-project/ecommerce": "dev-master"
If the same problem persist try this :
"sonata-project/ecommerce": "2.3.*#dev"

Why composer update updates symfony to 2.5 but it's "symfony/symfony": "~2.4"?

Maybe I'm totally wrong about how Composer works, but given the following composer.json (part of Symfony, with some added requirements not shown here):
"require": {
"php": ">=5.3.3",
"symfony/symfony": "~2.4",
"doctrine/orm": "dev-master",
"doctrine/dbal": "dev-master",
"doctrine/doctrine-bundle": "dev-master",
"twig/extensions": "~1.0",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~2.3",
"sensio/framework-extra-bundle": "~3.0",
"sensio/generator-bundle": "~2.3",
"incenteev/composer-parameter-handler": "~2.0",
// my requirements here
}
When I run composer update I get symfony/symfony 2.5 instead of ~2.4 (that is AFAIK 2.4.1, 2.4.2, etc).
~2.4 is equivalent of >=2.4,<3.0. If you would like to stay with 2.4.x branch you would have to use 2.4.*.
You can read more about version numbers on Composer's documentation pages: https://getcomposer.org/doc/01-basic-usage.md#package-versions

Categories