Created
December 4, 2012 15:44
-
-
Save Tocacar/4205314 to your computer and use it in GitHub Desktop.
Symfony 2 entity field type problem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //GrantType form class | |
| $builder->add('funder', 'entity', array( | |
| 'label' => 'funder', | |
| 'class' => 'Grants\CoreBundle\Entity\Funder', | |
| 'property' => 'name', | |
| 'empty_value' => 'Choose a funding body' | |
| )); | |
| //Grant class (to see relationship with Funder entity) | |
| /** | |
| * @var integer $funder_id | |
| * | |
| * @ORM\Column(name="funder_id", type="integer") | |
| */ | |
| private $funder_id; | |
| /** | |
| * @ORM\ManyToOne(targetEntity="Funder", inversedBy="grants") | |
| * @ORM\JoinColumn(name="funder_id", referencedColumnName="id") | |
| */ | |
| private $funder; | |
| //Funder class (to see the other side of the relationship) | |
| /** | |
| * @var ArrayCollection $grants | |
| * | |
| * @ORM\OneToMany(targetEntity="Grant", mappedBy="funder") | |
| */ | |
| private $grants; | |
| //The error in full | |
| Entity was not found. | |
| 500 Internal Server Error - EntityNotFoundException | |
| Stack Trace | |
| in kernel.root_dir/cache/dev/doctrine/orm/Proxies/__CG__GrantsCoreBundleEntityFunder.php at line 32 -+ | |
| } | |
| if ($this->_entityPersister->load($this->_identifier, $this) === null) { | |
| throw new \Doctrine\ORM\EntityNotFoundException(); | |
| } | |
| unset($this->_entityPersister, $this->_identifier); | |
| } | |
| at Funder ->__load () | |
| in /Library/WebServer/Documents/grants/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php at line 2985 -+ | |
| at UnitOfWork ->initializeObject (object(Funder)) | |
| in /Library/WebServer/Documents/grants/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php at line 831 -+ | |
| at EntityManager ->initializeObject (object(Funder)) | |
| in kernel.root_dir/cache/dev/jms_diextra/doctrine/EntityManager_50b8ce885e74e.php at line 149 -+ | |
| at EntityManager ->initializeObject (object(Funder)) | |
| in /Library/WebServer/Documents/grants/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Form/ChoiceList/EntityChoiceList.php at line 398 -+ | |
| at EntityChoiceList ->getIdentifierValues (object(Funder)) | |
| in /Library/WebServer/Documents/grants/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Form/ChoiceList/EntityChoiceList.php at line 244 -+ | |
| at EntityChoiceList ->getValuesForChoices (array(object(Funder))) | |
| in /Library/WebServer/Documents/grants/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/DataTransformer/ChoiceToValueTransformer.php at line 38 -+ | |
| at ChoiceToValueTransformer ->transform (object(Funder)) | |
| in /Library/WebServer/Documents/grants/vendor/symfony/symfony/src/Symfony/Component/Form/Form.php at line 1043 -+ | |
| at Form ->normToView (object(Funder)) | |
| in /Library/WebServer/Documents/grants/vendor/symfony/symfony/src/Symfony/Component/Form/Form.php at line 375 -+ | |
| at Form ->setData (object(Funder)) | |
| in /Library/WebServer/Documents/grants/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/DataMapper/PropertyPathMapper.php at line 42 -+ | |
| at PropertyPathMapper ->mapDataToForms (object(Grant), array(object(Form))) | |
| in /Library/WebServer/Documents/grants/vendor/symfony/symfony/src/Symfony/Component/Form/Form.php at line 860 -+ | |
| at Form ->add (object(Form)) | |
| in /Library/WebServer/Documents/grants/vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilder.php at line 215 -+ | |
| at FormBuilder ->getForm () | |
| in /Library/WebServer/Documents/grants/vendor/symfony/symfony/src/Symfony/Component/Form/FormFactory.php at line 39 -+ | |
| at FormFactory ->create (object(GrantType), object(Grant), array()) | |
| in /Library/WebServer/Documents/grants/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php at line 156 -+ | |
| at Controller ->createForm (object(GrantType), object(Grant)) | |
| in /Library/WebServer/Documents/grants/src/Grants/CoreBundle/Controller/GrantController.php at line 38 -+ | |
| at GrantController ->editAction (object(Grant)) | |
| at call_user_func_array (array(object(GrantController), 'editAction'), array(object(Grant))) | |
| in kernel.root_dir/bootstrap.php.cache at line 1426 -+ | |
| at HttpKernel ->handleRaw (object(Request), '1') | |
| in kernel.root_dir/bootstrap.php.cache at line 1390 -+ | |
| at HttpKernel ->handle (object(Request), '1', true) | |
| in kernel.root_dir/bootstrap.php.cache at line 1566 -+ | |
| at HttpKernel ->handle (object(Request), '1', true) | |
| in kernel.root_dir/bootstrap.php.cache at line 617 -+ | |
| at Kernel ->handle (object(Request)) | |
| in /Library/WebServer/Documents/grants/web/app_dev.php at line 28 -+ | |
| Logs +- | |
| 1 error | |
| DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\ProfilerListener::onKernelRequest". | |
| DEBUG - Notified event "kernel.request" to listener "Symfony\Bundle\FrameworkBundle\EventListener\SessionListener::onKernelRequest". | |
| DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\RouterListener::onKernelRequest". | |
| INFO - Matched route "grant_edit" (parameters: "_controller": "Grants\CoreBundle\Controller\GrantController::editAction", "id": "2", "_route": "grant_edit") | |
| DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\LocaleListener::onKernelRequest". | |
| DEBUG - Notified event "kernel.request" to listener "Symfony\Component\Security\Http\Firewall::onKernelRequest". | |
| DEBUG - Read SecurityContext from the session | |
| DEBUG - Reloading user from user provider. | |
| DEBUG - SELECT t0.username AS username1, t0.username_canonical AS username_canonical2, t0.email AS email3, t0.email_canonical AS email_canonical4, t0.enabled AS enabled5, t0.salt AS salt6, t0.password AS password7, t0.last_login AS last_login8, t0.locked AS locked9, t0.expired AS expired10, t0.expires_at AS expires_at11, t0.confirmation_token AS confirmation_token12, t0.password_requested_at AS password_requested_at13, t0.roles AS roles14, t0.credentials_expired AS credentials_expired15, t0.credentials_expire_at AS credentials_expire_at16, t0.id AS id17 FROM fos_user t0 WHERE t0.id = ? LIMIT 1 | |
| DEBUG - Username "Tocacar" was reloaded from user provider. | |
| DEBUG - Notified event "kernel.request" to listener "Symfony\Bundle\AsseticBundle\EventListener\RequestListener::onKernelRequest". | |
| DEBUG - Notified event "kernel.controller" to listener "Symfony\Bundle\FrameworkBundle\DataCollector\RouterDataCollector::onKernelController". | |
| DEBUG - Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ControllerListener::onKernelController". | |
| DEBUG - Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ParamConverterListener::onKernelController". | |
| DEBUG - SELECT t0.id AS id1, t0.title AS title2, t0.startDate AS startDate3, t0.endDate AS endDate4, t0.duration AS duration5, t0.acronym AS acronym6, t0.sumRequested AS sumRequested7, t0.sumAwarded AS sumAwarded8, t0.sumAwardedConverted AS sumAwardedConverted9, t0.exchangeRate AS exchangeRate10, t0.reference AS reference11, t0.slug AS slug12, t0.lastViewedTimestamp AS lastViewedTimestamp13, t0.lastViewedBy AS lastViewedBy14, t0.modifiedTimestamp AS modifiedTimestamp15, t0.modifiedBy AS modifiedBy16, t0.visits AS visits17, t0.status_id AS status_id18, t0.funder_id AS funder_id19, t0.type_id AS type_id20, t0.currency_id AS currency_id21, t0.costcentre_id AS costcentre_id22, t0.status_id AS status_id23, t0.funder_id AS funder_id24, t0.type_id AS type_id25, t0.currency_id AS currency_id26, t0.costcentre_id AS costcentre_id27 FROM grantentity t0 WHERE t0.id = ? | |
| DEBUG - Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\TemplateListener::onKernelController". | |
| DEBUG - Notified event "kernel.controller" to listener "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector::onKernelController". | |
| DEBUG - SELECT t0.id AS id1, t0.name AS name2 FROM funder t0 WHERE t0.id = ? | |
| DEBUG - Notified event "kernel.exception" to listener "Symfony\Component\Security\Http\Firewall\ExceptionListener::onKernelException". | |
| DEBUG - Notified event "kernel.exception" to listener "Symfony\Component\HttpKernel\EventListener\ProfilerListener::onKernelException". | |
| DEBUG - Notified event "kernel.exception" to listener "Symfony\Component\HttpKernel\EventListener\ExceptionListener::onKernelException". | |
| CRITICAL - Doctrine\ORM\EntityNotFoundException: Entity was not found. (uncaught exception) at /Library/WebServer/Documents/grants/app/cache/dev/doctrine/orm/Proxies/__CG__GrantsCoreBundleEntityFunder.php line 32 | |
| DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\ProfilerListener::onKernelRequest". | |
| DEBUG - Notified event "kernel.request" to listener "Symfony\Bundle\FrameworkBundle\EventListener\SessionListener::onKernelRequest". | |
| DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\RouterListener::onKernelRequest". | |
| DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\LocaleListener::onKernelRequest". | |
| DEBUG - Notified event "kernel.request" to listener "Symfony\Component\Security\Http\Firewall::onKernelRequest". | |
| DEBUG - Notified event "kernel.request" to listener "Symfony\Bundle\AsseticBundle\EventListener\RequestListener::onKernelRequest". | |
| DEBUG - Notified event "kernel.controller" to listener "Symfony\Bundle\FrameworkBundle\DataCollector\RouterDataCollector::onKernelController". | |
| DEBUG - Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ControllerListener::onKernelController". | |
| DEBUG - Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ParamConverterListener::onKernelController". | |
| DEBUG - Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\TemplateListener::onKernelController". | |
| DEBUG - Notified event "kernel.controller" to listener "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector::onKernelController". | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment