I added the docrtine-fixtures and the doctrine-fixtures-bundle to my dependencies in the composer.json, as follow:
{
"require": {
"php": ">=5.3.3",
"symfony/finder": "2.3.*",
"doctrine/orm": "~2.2,>=2.2.3",
"doctrine/doctrine-bundle": "~1.2",
"incenteev/composer-parameter-handler": "~2.0",
"doctrine/data-fixtures": "~1.1",
"doctrine/doctrine-fixtures-bundle": "~2.2",
"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"
}
}
And then I did php-cli composer.phar update, which worked and displayed the right message on my terminal:
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Updating doctrine/data-fixtures (dev-master bd44f6b => v1.1.1)
Checking out bd44f6b6e40247b6530bc8abe802e4e4d914976a
Writing lock file
Generating autoload files
Bu when I go to the folder vendor/doctrine, I cannot find any data-fixtures repository. What is the issue? Why does composer not load it and why does it display success messages?
(PS: My solution was to add the doctrine-fixture repository manually but it doesn't solve the composer issue).
It could be a Composer caching issue. Try removing Composer's cache directory:
rm -rf ~/.composer/cache
Related
I need to install a new dependency in one old symfony 2.3 application. But seems that the previous installed packages are to old that I get the next error: "Your requirements could not be resolved to an installable set of packages."
This are my current dependencies:
"php": ">=5.3.
"symfony/symfony": "2.3.*",
"doctrine/orm": ">=2.2.3,<2.4-dev",
"doctrine/doctrine-bundle": "1.2.*",
"twig/extensions": "1.0.*",
"symfony/assetic-bundle": "2.3.*",
"symfony/swiftmailer-bundle": "2.3.*",
"symfony/monolog-bundle": "2.3.*",
"sensio/distribution-bundle": "2.3.*",
"sensio/framework-extra-bundle": "2.3.*",
"sensio/generator-bundle": "2.3.*",
"incenteev/composer-parameter-handler": "~2.0",
"doctrine/doctrine-fixtures-bundle": "dev-master",
"doctrine/data-fixtures": "dev-master",
"knplabs/knp-menu":"dev-master",
"knplabs/knp-menu-bundle":"dev-master",
"liuggio/excelbundle": ">=1.0.4",
"tecnick.com/tcpdf": "6.0.023"
I need to add: "phpoffice/phpword": "v0.13.*" that require zend framework's packages.
There is any way of install my new dependencie without affect the already installed packages?
If you run composer why-not "phpoffice/phpword", you may get additional clarity as to what the problem is, and start to work around it by updating some packages to newer versions that can work together.
When I use this command in cmd
php composer.phar update friendsofsymfony/user-bundle
I get this message
Please provide a version constraint for the
friendsofsymfony/user-bundle requirement: 2.0.*#dev 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 friendsofsymfony/user-bundle 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.
Installation failed, reverting composer.json to its original content.
I've already added "minimum-stability": "dev", in my composer.json
It's the first time that I head this problem I installed fosuserbundle manytimes and it worked before.
I just Advice you just use this to configure all the sonata admin + fos user bundle without any dependencies or version conflicts
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.5.*",
"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",
"sonata-project/admin-bundle": "~2.3#dev",
"sonata-project/doctrine-orm-admin-bundle": "~2.3#dev",
"sonata-project/core-bundle": "~2.2#dev",
"sonata-project/user-bundle": "2.2.x-dev",
"friendsofsymfony/user-bundle": "~1.3#dev",
"sonata-project/easy-extends-bundle": "~2.1#dev",
"sonata-project/intl-bundle": "2.2.x-dev",
"knplabs/knp-paginator-bundle": "dev-master",
"knplabs/knp-time-bundle": "dev-master",
"knplabs/knp-menu-bundle": "1.1.*",
"jms/serializer-bundle": "0.13.*#dev"
},
So I fixed, it should be:
"friendsofsymfony/user-bundle": "~2.0#dev"
not
"friendsofsymfony/user-bundle ": "~2.0#dev"
I created a frontend API for an existing tourism booking system. In order to distribute it, I want to reduce the size of my /vendor directory. It has a total size of 26.4 MB.
Those are the biggest directories in /vendor (size in KB):
14402 ./symfony
4611 ./swiftmailer
3501 ./doctrine
2032 ./twig
844 ./monolog
826 ./silex
105 ./composer
56 ./pimple
39 ./psr
This is my composer.json file: http://pastebin.com/mBi5V0PH. I already removed unnecessary libraries, but the biggest chunk are ./swiftmailer and ./symfony and add to over 20MB.
How can I reduce the size to a total of around 10MB?
Unfortunately, there is not really a way to optimize included libraries for distribution. The only optimization I would suggest is to separate your development dependencies. Assuming you're using symfony/browser-kit and symfony/css-selector for testing, you could put those into the require-dev section in your composer.json.
{
"require": {
"doctrine/dbal": ">=2.2.0,<2.4.0-dev",
"monolog/monolog": ">=1.0.0",
"php": ">=5.3.2",
"silex/silex": "~1.2",
"swiftmailer/swiftmailer": "5.*",
"symfony/config": "~2.3",
"symfony/console": "~2.3",
"symfony/finder": "~2.3",
"symfony/form": "~2.3",
"symfony/locale": "~2.3",
"symfony/translation": "~2.3",
"symfony/twig-bridge": "~2.3",
"symfony/validator": "~2.3",
"symfony/yaml": "~2.3",
"twig/twig": ">=1.8,<2.0-dev",
"twig/extensions": "*"
},
"require-dev": {
"symfony/browser-kit": "~2.3",
"symfony/css-selector": "~2.3"
}
}
Then before you zip up your distribution, run composer with
composer install --no-dev
I am trying to set up Symfony with the SonataUserBundle. User registration and login works fine. When I try to call up the /profile view, however I get the following error:
Attempted to call method "setCurrentUri" on class "Knp\Menu\MenuItem" in F:\<my project path>\vendor\sonata-project\user-bundle\Block\ProfileMenuBlockService.php line 91. Did you mean to call: "setCurrent"?
The last notice in the "event list" before the error is
INFO - [cms::renderBlock] block.id=53, block.type=sonata.user.block.menu
Has anyone encountered this error before and can provide information on how to resolve it?
TIA
Matt
What versions of KnpMenu and SonataBlockBundle are you using? Please check your composer.json to be sure.
The setCurrentUri method has been deprecated as of KnpMenu v. 2.0, and the composer.json of SonataBlockBundle does not require KnpMenu anywhere but in dev install. So, this leads to a possibility that you could have required a fresher version of knplabs/knp-menu-bundle that is not yet supported by Sonata bundle.
Try requiring knplabs/knp-menu-bundle in 1.1.x:
{
...
"require": {
"knplabs/knp-menu-bundle": "~1.1"
},
...
}
I encountered the same problem, but downgrade to Knpmenu version 1 is not possible for our project. Because of some code update the June 16th, it is now possible to use Sonata User Bundle and Knp Menu Version 2.
Please, have a look on my composer.json :
"require": {
"php": ">=5.3.9",
"symfony/symfony": "2.7.*",
"doctrine/orm": "^2.4.8",
"doctrine/doctrine-bundle": "~1.4",
"doctrine/doctrine-fixtures-bundle": "dev-master",
"doctrine/migrations": "dev-master",
"doctrine/doctrine-migrations-bundle": "dev-master",
"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",
"friendsofsymfony/user-bundle": "~1.3",
"friendsofsymfony/message-bundle": "^1.2",
"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": "dev-master",
"sonata-project/datagrid-bundle": "dev-master",
"sonata-project/block-bundle": "~2.2,>=2.2.7,<2.3",
"sonata-project/exporter": "^1.4",
"sonata-project/intl-bundle": "^2.2",
"knplabs/knp-menu-bundle": "~2.0",
"knplabs/knp-menu": "~2.0"
},
As you can see, sonata-project/user-bundle is under dev-master version and I had to add sonata-project/datagrid-bundle in dev-master
Hope to help developpers who want want to preserve KnpMenu V2 !
I had same issue, This is my solution that you can preserve KnpMenu V2.
-You change setCurrentUri to setCurrent (because KNP changed code) in C:\path\vendor\sonata-project\user-bundle\Block\ProfileMenuBlockService.php
-You can have this problem, Method "currentAncestor" for object "Knp\Menu\MenuItem" does not exist in Sonata
And this works for me.
After last update SonataAdminBundle (Mar 01, 2013) I can not update components using composer
composer.json
...
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.1.*",
"doctrine/orm": ">=2.2.3,<2.4-dev",
"doctrine/doctrine-bundle": "1.1.*",
"twig/extensions": "1.0.*#dev",
"symfony/assetic-bundle": "2.1.*",
"symfony/swiftmailer-bundle": "2.1.*",
"symfony/monolog-bundle": "2.1.*",
"sensio/distribution-bundle": "2.1.*",
"sensio/framework-extra-bundle": "2.1.*",
"sensio/generator-bundle": "2.1.*",
"jms/security-extra-bundle": "1.2.*",
"jms/di-extra-bundle": "1.1.*",
"kriswallsmith/assetic": "1.1.*#dev",
...
"sonata-project/admin-bundle": "dev-master",
"sonata-project/intl-bundle": "dev-master",
"sonata-project/doctrine-orm-admin-bundle": "dev-master",
"sonata-project/cache-bundle": "dev-master"
},
...
php composer.phar update symfony/symfony
Problem 1
- Installation request for sonata-project/admin-bundle dev-master -> satisfiable by sonata-project/admin-bundle dev-master.
- Can only install one of: sonata-project/admin-bundle dev-master, sonata-project/admin-bundle 2.1.x-dev.
- Installation request for sonata-project/admin-bundle == 2.1.9999999.9999999-dev -> satisfiable by sonata-project/admin-bundle 2.1.x-dev.
You have set the version of the sonata-project packages to dev-master. The master branch is in sync with the symfony's stable release. Since Symfony2.2 is released on 1 march, you need to update these versions to not require Symfony2.2, or update your project to symfony2.2 (shouldn't be that difficult).
Solution 1: Updating sonata-project versions
Change this:
"sonata-project/admin-bundle": "dev-master",
"sonata-project/intl-bundle": "dev-master",
"sonata-project/doctrine-orm-admin-bundle": "dev-master",
"sonata-project/cache-bundle": "dev-master"
to
"sonata-project/admin-bundle": "2.1.x",
"sonata-project/intl-bundle": "dev-master",
"sonata-project/doctrine-orm-admin-bundle": "2.1.x",
"sonata-project/cache-bundle": "dev-master"
Solution 2: Updating Symfony2.1 to 2.2
Read the news article on how to update your project from Symfony2.1 to 2.2. Basically, this means updating the composer.json according to the changes on the main repo, running php composer.phar update and reading the UPGRADE-2.2.md file on what has changed.
Try:
"sonata-project/admin-bundle": "2.1.*",
"sonata-project/doctrine-orm-admin-bundle": "2.1.*#dev",
"sonata-project/intl-bundle": "2.1.*",
"sonata-project/cache-bundle": "2.1.*"
It's work for me.