How Can I update the version of Doctrine2 and ORM in my symfony project?
This question is because I have tried to update only one bundle but the console returns error, and I have to update all the bundles.
Thanks.
You need to use composer. You can run next command:
php composer.phar update
Also composer try to update all your requires in composer.json file.
But if you only want to install or update one dependency, you can whitelist them:
php composer.phar update doctrine/orm
php composer.phar update doctrine/doctrine-bundle
Run composer update doctrine/* to update all doctrine packages
Related
I am using composer with a symfony project which require sonata-project/sonata-doctrine-orm-bundle and its dependencies (naturally with many other dependencies).
When I update symfony 2.3.6 to 2.5.5 and my vendors turn by turn, it updates sonata doctrine orm bundle which was written using PSR-0 autoloader and now uses PSR-4.
When composer finished to update all vendors and the symfony console command cache:clear run I get an error like class Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle can not be found.
When I look around to check what could be wrong, I discovered that the file vendor/composer/autoload_psr4.php is not updated with the path. The composer.json of sonata doctrine orm admin bundle is compliant with the paths I found in my vendor directory.
Does anyone have had the same or similar issue ? I can't find anything interesting about this...
Try to update composer, this was the issue I had when having problems with PSR-4 autoloading
I added a new bundle dependency to my composer.json file and when running composer update command, the composer updates all existent deps while I just want to install the new bundle.
Is there a command option to install just the new deps without updating existent ones ?
Is there a command option to install just the new deps without updating existant ones?
Yes, there is: composer require.
Simply run composer require vendor/package.
From the docs
In order to get the latest versions of the dependencies and to update the composer.lock file, you should use the update command.
php composer.phar update
This will resolve all dependencies of the project and write the exact versions into composer.lock.
If you just want to update a few packages and not all, you can list them as such:
php composer.phar update vendor/package vendor/package2
You can also use wildcards to update a bunch of packages at once:
php composer.phar update vendor/*
I am new to symfony and I want to use Propel in my project. I have setup the project with symfony2 with composer and want to use propel 1.6. I have kept my propel inside vendor. After adding $bundles = array(new Propel\PropelBundle\PropelBundle()) it throws error, class is not defined.
I have installed propel from github and follow the documentation.
You did only install propel but not the propel-bundle which provides the symfony2-integration.
Add this to your composer.json in order to install propel-bundle:
"propel/propel-bundle": "1.2.*#dev"
... now propel itself will automatically be downloaded aswell as propel-bundle depends on it.
Now update your dependencies:
composer update
Afterwards clear your cache:
app/console cache:clear
I want to upgrade my app that I've developed with Symfony2 for users who want to use it do so with composer.
I don't know how to create composer.json file based on deps file.
This's my deps file: https://github.com/biruwon/Vecinos2.0/blob/master/deps
For example, what about with the bundles without composer.json? Or libraries how TCPDF upload on sourceforge?
If you help me here or with a pull request I'll be very thankful to you.
PD: I do this first and then update Symfony2 to Symfony2.1
For TCPDF it's quite easy it is on packagist already.
For bundles or libs that are not on packagist, the best way is to first get it to work in your project using a custom package repository in your composer.json, and once that's done sending a pull request to the original author with a composer.json and asking them to submit it to Packagist is the way to go.
Download the composer in symfony2 root folder:
curl -s https://getcomposer.org/installer | php
and execute
php composer.phar self-update
php composer.phar update
use this if you can update to the last version.
Why symfony 2 uses both, the deps file and the composer.json file?
I can see some documents tell me to:
php bin/vendors install
Whilst the other tell me to:
php composer.phar install
The deps file and bin/vendors script are used in Symfony 2.0.x, while Symfony 2.1.x has switched to Composer. The bin/vendors script was just a stub because Composer was not ready for production when Symfony 2.0.0 was released.