Cannot install symfony with option --webapp - symfony

I try to install symfony v5.
Following the documentation, (https://symfony.com/doc/5.4/setup.html#creating-symfony-applications) i have the error "Incorrect usage: flag provided but not defined: --webapp".
Same error with symfony cli and composer.
How can i resolve this problem ? No help in the documentation... Each new version of symfony becomes more complicated. :-(
Thank you for your help.
Here's my configuration:
php: v7.3
symfony (CLI): v4.24.1
composer: v1.10.15

Maybe try to upgrade Your symfony version. For my symfony version (5.3.13) it works correctly

Related

assert error in symfony/translations when dumping translations

I have recently updated my project from symfony 6.1 to symfony 6.2 and I'm experiencing issue while dumping translations
commend that I use:
bin/console translation:extract pl --force --format=yaml
results in:
exception trace points to
vendor/nikic/php-parser/lib/PhpParser/Node/Expr/CallLike.php:36
I've already updated all packages, especially symfont/translation to version 6.2.*
For now, only downgrading symfony back to 6.1 solves this for me.
This issue has been fixed in symfony 6.2.2. You can update your project and try again.
It has been resolved in my projects.
composer update "symfony/*"

Symfony 5 doctrine_migrations error on script boot

As far as i can tell, i can't see any other questions that ask this, so here goes:
I've been running the latest Symfony, for a side project, and encountered this error as i was writing the app. Nothing i do now fixes it, not even re-installing symfony, and i have no idea what the problem even is. I am getting the error:
The parameter "doctrine_migrations.dir_name" has a dependency on a
non-existent parameter "kernel.root_dir". Did you mean one of these:
"kernel.project_dir", "kernel.cache_dir", "kernel.logs_dir"?
It seems that you are using the undefined kernel.root_dir variable in your config/packages/doctrine_migrations.yaml config file.
You should replace it by kernel.project_dir:
# config/packages/doctrine_migrations.yaml
doctrine_migrations:
dir_name: '%kernel.project_dir%/src/Migrations'
See: https://symfony.com/doc/master/bundles/DoctrineMigrationsBundle/index.html#configuration
Just to document the root cause.
Symfony 5 removed kernel.root_dir parameters. Doctrine Migrations Bundle uses it as default value for dir_name.
It's been discussed. See https://github.com/doctrine/DoctrineMigrationsBundle/issues/305 and https://github.com/doctrine/DoctrineMigrationsBundle/pull/295.
SOLUTION: right now (Symfony 5 and Migrations bundle 2.1.x), you should not delete doctrine_migrations.yaml. Leave it there with a dir_name that does not raise en error.
at this point i am assuming it is a symfony bug, so i will close this question. Thanks for everyone's help!
try
composer remove orm
composer require symfony/orm-pack

class PHPUnit\Framework\ExpectationFailedException not found

when I try to run a failed test with this command :
./vendor/bin/phpunit
I get this Fatal Error :
PHPUnit 5.7.20 by Sebastian Bergmann and contributors.
PHP Fatal error: Class 'PHPUnit\Framework\ExpectationFailedException'
not found in /var/www/zend/vendor/zendframework/zend-
test/src/PHPUnit/Controller/AbstractControllerTestCase.php on line 444
Your version of phpunit is probably too old for your version of Zend. The class PHPUnit\Framework\ExpectationFailedException have been renamed in PhpUnit 6.X from PHPUnit_Framework_ExpectationFailedException to ExpectationFailedException
Please check your PhpUnit version: phpunit --version, it should be 6.X. Update it to the last version to avoid this error.
This is "fixed" by a script in Zend\Test called phpunit-class-aliases.php but it's not configured properly IMHO since it's in the autoload-dev section (meaning it doesn't propagate out to other projects.)
So, in your project composer.json, do something like this:
"autoload-dev": {
"files": [
"vendor/zendframework/zend-test/autoload/phpunit-class-aliases.php"
]
},
Then composer install
N.B. Zend\Test has a pull request that fixes this very thing, but they're saying it's PHPUnit's fault (Shame on you PHPUnit 4 for... idunno... having the wrong class name according to Zend\Test) So, I've done it instead: composer require illchuk/phpunit-class-aliases
This is a configuration flaw in zend-test. It consumes classes from Phpunit 6 but per it's Composer requirements, Phpunit before that version are OK to require:
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0",
Most likely as your system because of the PHP version does not satisfy the requirements of Phpunit 6, the next lower version was installed.
As the code in the base test case (https://github.com/zendframework/zend-test/blob/master/src/PHPUnit/Controller/AbstractControllerTestCase.php#L444) makes use of Phpunit 6 classes, I strongly assume that when the configuration flaw is made aware to the Zend-Test project, you won't be even able to install on your system any longer.
Therefore upgrade to a recent PHP version and then run
composer update
If you're stuk with the PHP version, downgrade zend-test to a version that supports an older Phpunit version. I don't know that project well, so it's just a suggestion, I don't know if such a version exists or can't even recommend one.
I filed a report, perhaps using that one class was an oversight or there is a less hard way to resolve the dependency: https://github.com/zendframework/zend-test/issues/50

Cannot run the test example of sfPhpExcel

I have installed sfPhpExcelPlugin successfully and now I am trying to run an example as per the direction of symfony plugin's website.
I am getting this error, do you guys know how to solve it?
C:\wamp\www\orangehrm-3.01\symfony>php symfony plugins/sfPhpExcelPlugin/examples_1_2/01simple.php
Task "plugins/sfPhpExcelPlugin/examples_1_2/01simple.php" is not defined.
By using php symfony command you are trying to run Symfony task. Your example of sfPhpExcelPlugin is not a Symfony task. Try:
php plugins/sfPhpExcelPlugin/examples_1_2/01simple.php
And to see list of all available Symfony task type:
php symfony

Getting troubles when trying to install FOSUserBundle to Symfony2

When I'm trying to install FOSUserBundle I'm getting the following error:
Fatal error: Call to undefined method Symfony\Bundle\DoctrineBundle\Registry::getManager() in W:\symproject\app\cache\dev\appDevDebugProjectContainer.php on line 1039
What can it be?
I've also tried to install FOSUserBundle to a pure Symfony Standart Edition and encountered the same issue.
I followed along this documentation.
You probably have installed latest FOSUserBundle which is used for Symfony2.1.x
If you are using Symfony2.0.x change your deps file:
[FOSUserBundle]
git=git://github.com/FriendsOfSymfony/FOSUserBundle.git
target=bundles/FOS/UserBundle
version=1.2.0
then reinstall the vendors with:
php bin/vendors install
I have been using FOS User Bundle for a long time, and this weekend my automatic build stopped working with exactly the error you wrote here. So for me I then found the solution :)
It seems like the latest version of FOS User Bundle has a bug, so I added this to the deps.lock file:
FOSUserBundle f487dc16cec6003c46542a90d5193761fd91360a
In deps file I have:
[FOSUserBundle]
git=http://github.com/FriendsOfSymfony/FOSUserBundle.git
target=bundles/FOS/UserBundle
And voila! It now works!
(The commit f487d... was just chosen from the commits 4 days ago - when I know it was working)
This should fix your problem!
I've updated from 2.0.16 to 2.1 dev-master with composer, got the same error...
my solution:
In orm.xml
factory-service="doctrine" factory-method="getManager"
replace with
factory-service="doctrine" factory-method="getEntityManager"
Also if you are using Symfony 2.0.x there's not such method as getManager, instead you have to use getEntityManager to get it working.
i think you have missed Doctrine ORM mapping in config.yml
doctrine:
orm:
auto_generate_proxy_classes: %kernel.debug%
entity_managers:
default:
mappings:
FOSUserBundle: ~
try this hope this will work...

Resources