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
Related
I was running Symfony 4.4.8, and I wanted to update my project. So I ran:
composer update
It did automatically update the DoctrineMigrationsBundle (https://packagist.org/packages/doctrine/doctrine-migrations-bundle) from 2.1.2 to 3.0.1.
Composer failed at first because doctrine_migrations.yaml was not compatible with the DoctrineMigrationsBundle 3.0.1, so I ran:
composer recipes:install --force -v
composer install
But: it appears that the DoctrineMigrationsBundle v 3 has a totally different configuration and does not use the "migrations_versions" SQL table anymore, but a new "doctrine_migrations_versions"-table and a new migrations directory ('%kernel.project_dir%/migrations' instead of '%kernel.project_dir%/src/Migrations').
This means that every time you do:
php bin/console doctrine:migrations:diff
You will get in the migration:
$this->addSql('DROP TABLE migration_versions');
I read at https://symfony.com/doc/master/bundles/DoctrineMigrationsBundle/index.html that you can set the table name in doctrine_migrations.yaml manually like this:
doctrine_migrations:
storage:
table_storage:
'table_name': 'doctrine_migrations'
But that is of no use, because the v 3 table has an extra column "execution_time" and in the "version" column a namespace is prepended (e.g. "DoctrineMigrations\Version20200702112735.php"). So both tables are incompatible.
I can't find any information anywhere on properly upgrading DoctrineMigrationsBundle from v2 to v3.
I must say I am surprised by this, I thought that "composer update" was to be safe. Appearently, one of the symfony bundles didn't add a version limit automatically where it should if an upgrade is not possible.
So what should I do? Should I just let composer downgrade the DoctrineMigrationsBundle again? Or is there some way to get an upgrade of DoctrineMigrationsBundle from v2 to v3 to work after all?
I think everything is explained here: https://github.com/doctrine/migrations/blob/master/UPGRADE.md
If you have already update the bundle config, just run that command:
bin/console doctrine:migrations:sync-metadata-storage
It should work.
PhpStorm version is 2020.1
I use composer create-project symfony/website-skeleton . to create new app
Use php bin/console make:entity make new entity
make:migration and doctrine:migrations:migrate to make database table
In Repository.php file, the createQueryBuilder('a')->andWhere('a.can not auto-completion')
I have installed Symfony plugin for PhpStorm.
Why and how to fix it?
i'm new to the symfony framework and i'm trying to generate my first bundle ,
i use this command php bin/console generate:bundle but it's not working.
The error message :
There are no commands defined in the "generate" namespace.
You may be looking for a command provided by the SensioGeneratorBundle which is currently not installed.
Try running composer require sensio/generator-bundle.
https://imgur.com/csryfHZ
I've tried to install composer repositories with the command composer require sensio/generator-bundle and nothing has changed
In symfony 4, this bundle is deprecated, you must use the maker-bundle, unfortunately there is no bundle generator available. So you'll need to code your bundle from scratch with the official documentation: https://symfony.com/doc/current/bundles/best_practices.html
By the way, bundle are deprecated and are now only use to share packaged code between projects.
More informations at: https://symfony.com/doc/current/bundles.html
We're not making bundle in Symfony 4.
While it was "good practice" withg Symfony 2, since the new skeleton, it's not the case anymore.
Your default bundle is now App, all your code goes in src/, and all your view (twig files) goes in template/
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
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