i am getting an error, when applying
php app/console doctrine:schema:update --force
i get a stack of errors, starting with
PHP Fatal error: Declaration of Tracker\MembersBundle\Entity\User::addGroup() must be
compatible with that of FOS\UserBundle\Model\GroupableInterface::addGroup() in C:\Program Files (x86)\Zend\Apache2\htdocs\mysite\src\Tracker\MembersBundle\Entity\User.php on line 14
PHP Stack trace:
PHP 1. {main}() C:\Program Files (x86)\Zend\Apache2\htdocs\mysite\app\console:0
PHP 2. Symfony\Component\Console\Application->run() C:\Program Files (x86)\Zend\Apache2\htdocs\mysite\app\console:22
PHP 3. Symfony\Bundle\FrameworkBundle\Console\Application->doRun() C:\Program Files (x86)\Zend\Apache2\htdocs\mysite\vendor\symfony\src\Symfony\Component\Console\Application.php:118
PHP 4. Symfony\Component\Console\Application->doRun() C:\Program Files (x86)\Zend\Apache2\htdocs\mysite\vendor\symfony\src\Symfony\Bundle\FrameworkBundle\Console\Application.php:75
i figured out User::addGroup() and the groups implementation of FOSUserBundle ...but i do not know how to ultimately solve it...here are my two entities
User
Group
Update:
if i simply remove addGroup() from the User Entity, and go to the path
http://mysite.com/app_dev.php/group/new
i get a fatal error
Fatal error: Declaration of FOS\UserBundle\Form\Type\GroupFormType::getDefaultOptions() must be compatible with that of Symfony\Component\Form\FormTypeInterface::getDefaultOptions() in C:\Program Files (x86)\Zend\Apache2\htdocs\mysite\vendor\bundles\FOS\UserBundle\Form\Type\GroupFormType.php on line 18
You have to add FQCN of GroupableInterface in your User class e.g
use FOS\UserBundle\Model\GroupableInterface;
Edit:
You have to update symfony. As they have changed function signature of getDefaultOptions. Check here.
you should remove from:
vendor\yourBundle\Entity\User;
getter setter group function coz it was already declared on
use FOS\UserBundle\Model\User.php;
it can be duplicate function !
now generate your schema i hope it helps you :D
Related
i try to add a new entity with the maker bundle of Symfony, but i can't get rid of this error , any help please :/ ?
it happen right after
php bin/console make:entity
Class name of the entity to create or update (e.g. GrumpyJellybean):
> Customer
Your entity already exists! So let's add some new fields!
PHP Fatal error: During class fetch: Uncaught ErrorException: Warning: chdir(): No such file or directory (errno......
Error: During class fetch: Uncaught ErrorException: Warning: chdir(): No such file or directory (errno 2) in
/Users/loic/Documents/TFE/cmi-3/vendor/symfony/debug/DebugClassLoader.php:458
Stack trace:
#0 phar:///Users/loic/Documents/TFE/cmi-3/vendor/phpstan/phpstan-shim/phpstan.phar/vendor/nikic/php-parser/l
ib/PhpParser/Lexer/Emulative.php(12): spl_autoload_call('PhpParser\\Lexer')
#1 /Users/loic/Documents/TFE/cmi-3/vendor/symfony/maker-bundle/src/Util/ClassSourceManipulator.php(63): spl_
autoload_call('PhpParser\\Lexer...')
#2 /Users/loic/Documents/TFE/cmi-3/vendor/symfony/maker-bundle/src/Maker/MakeEntity.php(743): Symfony\Bundle
\MakerBundle\Util\ClassSourceManipulator->__construct('<?php\n\nnamespac...', false)
#3 /Users/loic/Documents/TFE/cmi-3/vendor/symfony/maker-bundle/src/Maker/MakeEntity.php(167): Symfony\Bundle
\MakerBundle\Maker\MakeEntity->createClassManipulator('/Users/loic/Doc...', Object(Symfony\Bundle\MakerBundl
e\ConsoleStyle), false)
For now i got it working with
php bin/console make:entity --no-debug
it'll do the job but i still don't know what is happening.
I am trying to wrap dnsjava as a bundle in Karaf. When I try to start the bundle I get a "Missing Constraint" error. I looked in the dnsjava code and found that the only place android is referenced is in a Class.forName. So I am wondering what causes this problem and how can I get around it. I am pretty certain that the class is not referenced in the code anywhere.
Here is the exception:
opendaylight-user#root>bundle:start 288
Error executing command: Error executing command on bundles:
Unable to execute command on bundle 288: The bundle "dnsjava_2.1.8 [288]" could not be resolved. Reason: Missing Constraint: Import-Package: android.os; version="0.0.0"
I believe I found the answer. There is an Import in the MANIFEST.MF that requires android.os.
I am very new to Symfony. I have installed Symfony in my system with symfony demo command it's working fine. I installed in that folder already developed project code. when use php bin/console server:start 0.0.0.0:8000 this command I am getting error:
PHP Fatal error: Uncaught RuntimeException: The autoloader expected class "AppKernel" to be defined in file "/home/Desktop/commercetools-sunrise-php-master/vendor/composer/../../app/AppKernel.php". The file was found but the class was not in it, the class name or namespace probably has a typo. in /home/Desktop/commercetools-sunrise-php-master/vendor/symfony/symfony/src/Symfony/Component/Debug/DebugClassLoader.php:223
Stack trace:#0 [internal function]: Symfony\Component\Debug\DebugClassLoader->loadClass('AppKernel')#1 /home/Desktop/commercetools-sunrise-php-master/bin/console(26): spl_autoload_call('AppKernel')#2 {main}
thrown in /home/Desktop/commercetools-sunrise-php-master/vendor/symfony/symfony/src/Symfony/Component/Debug/DebugClassLoader.php on line 223
Any one can help me. Thanks in advance.
There may be a corrupted generated PHP file. Try this :
composer run-script post-install-cmd
I get an error when I try to run a test in PHPUnit. Even if I type phpunit by itself, I still get an error. It works fine when I call it outside the Bootstrap folder.
Configuration read from /home/milen/Documents/codific/icho/module/Application/tests/phpunit.xml
PHP Fatal error: Call to a member function getId() on a non-object in /home/milen/Documents/codific/icho/module/Application/tests/ApplicationTest/Controller/PoCourseTest.php on line 268
PHP Stack trace:
PHP 1. {main}() /usr/bin/phpunit:0
PHP 2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:46
PHP 3. PHPUnit_TextUI_Command->run() /usr/share/php/PHPUnit/TextUI/Command.php:129
PHP 4. PHPUnit_TextUI_TestRunner->doRun() /usr/share/php/PHPUnit/TextUI/Command.php:176
PHP 5. PHPUnit_Framework_TestSuite->run() /home/milen/Documents/codific/icho/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:426
PHP 6. PHPUnit_Extensions_SeleniumTestCase->run() /home/milen/Documents/codific/icho/vendor/phpunit/phpunit/src/Framework/TestSuite.php:699
PHP 7. PHPUnit_Framework_TestCase->run() /home/milen/Documents/codific/icho/vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumTestCase.php:648
PHP 8. PHPUnit_Framework_TestResult->run() /home/milen/Documents/codific/icho/vendor/phpunit/phpunit/src/Framework/TestCase.php:760
PHP 9. PHPUnit_Framework_TestCase->runBare() /home/milen/Documents/codific/icho/vendor/phpunit/phpunit/src/Framework/TestResult.php:686
PHP 10. PoCourseTest->tearDown() /home/milen/Documents/codific/icho/vendor/phpunit/phpunit/src/Framework/TestCase.php:852
I tried reinstalling it, no luck.
I usually see an error along these lines when I have defined a bootstap.php file to run for PHPUnit which gets specified in the phpunit.xml file. With this setup, you need to be careful from where you run your tests so that the bootstrap file is run properly. This isn't a problem of PHPUnit per se, but a side effect from the phpunit.xml file.
This would appear to be the case because you stated that when you are not in the folder called "Bootstrap" (what / where ever that is), PHPUnit works fine. But without more information aside from the error dump this would be difficult to ascertain.
I think this question could be fixed with this answer.
I don't think its a problem with configuration, but rather a code execution in the setUp and tearDown method.
I'm getting the following error when attempting to run my own Symfony unit tests in PhpStorm:
/usr/bin/php /home/kevin/www/src/Blah/MyBundle/Tests/Controller/HomeControllerTest.php
PHP Fatal error: Class 'Symfony\Bundle\FrameworkBundle\Test\WebTestCase' not found in /home/kevin/www/src/Blah/MyBundle/Tests/Controller/HomeControllerTest.php on line 8
PHP Stack trace:
PHP 1. {main}() /home/kevin/www/src/Blah/MyBundle/Tests/Controller/HomeControllerTest.php:0
Fatal error: Class 'Symfony\Bundle\FrameworkBundle\Test\WebTestCase' not found in /home/kevin/www/src/Blah/MyBundle/Tests/Controller/HomeControllerTest.php on line 8
Call Stack:
0.0002 234112 1. {main}() /home/kevin/www/src/Blah/MyBundle/Tests/Controller/HomeControllerTest.php:0
Process finished with exit code 255
Some research has informed me that I may have to point PhpStorm/Xdebug to Symfony's bootstrap and/or test suite XML file, but I'm not sure how to do that in PhpStorm. Nothing is jumping out at me in the various config screens. Please help.
Although I'm using IntelliJ IDEA, the configuration is the same, so:
Settings -> PHP -> PHPUnit - there are inputs for bootstrap and config