symfony - Doctrine annotation error in production server -
i have error in production server which doesn't occur in localhost:
annotationexception: [semantical error] annotation "@sensio\bundle\frameworkextrabundle\configuration\route" in method my\bundle\controller\mycontroller::indexaction() not exist, or not auto-loaded.
this error happened in local when tryed update packages composer , this didn't solve it, had reinstall symfony , upload again, and still happening.
cache has been cleared guess it's not cache thing.
appkernel.php
<?php use symfony\component\httpkernel\kernel; use symfony\component\config\loader\loaderinterface; class appkernel extends kernel { public function registerbundles() { $bundles = array( new symfony\bundle\frameworkbundle\frameworkbundle(), new symfony\bundle\securitybundle\securitybundle(), new symfony\bundle\twigbundle\twigbundle(), new symfony\bundle\monologbundle\monologbundle(), new symfony\bundle\swiftmailerbundle\swiftmailerbundle(), new symfony\bundle\asseticbundle\asseticbundle(), new doctrine\bundle\doctrinebundle\doctrinebundle(), new sensio\bundle\frameworkextrabundle\sensioframeworkextrabundle(), new jms\aopbundle\jmsaopbundle(), new jms\diextrabundle\jmsdiextrabundle($this), new jms\securityextrabundle\jmssecurityextrabundle(), new myproject\panelbundle\myprojectpanelbundle(), new myproject\productbundle\myprojectproductbundle(), new front\sitebundle\frontsitebundle(), ); if (in_array($this->getenvironment(), array('dev', 'test'))) { $bundles[] = new acme\demobundle\acmedemobundle(); $bundles[] = new symfony\bundle\webprofilerbundle\webprofilerbundle(); $bundles[] = new sensio\bundle\distributionbundle\sensiodistributionbundle(); $bundles[] = new sensio\bundle\generatorbundle\sensiogeneratorbundle(); } return $bundles; } public function registercontainerconfiguration(loaderinterface $loader) { $loader->load(__dir__.'/config/config_'.$this->getenvironment().'.yml'); } }
controller sample
and sample of anotattions in controller throws error:
/** * lists myent entities. * * @route("/", name="my_ent") * @method("get") * @template("myprojectpanelbundle:myent:index.html.twig") */ public function indexaction($ident) {
app/config/routing.yml
front_site: resource: "@frontsitebundle/resources/config/routing.yml" prefix: / myproject_product: resource: "@myprojectproductbundle/resources/config/routing.yml" prefix: / myproject_panel: resource: "@myprojectpanelbundle/resources/config/routing.yml" prefix: /
i had similar problem.
importing sensio\bundle\frameworkextrabundle\configuration\route class require_once solved it.
require_once __dir__ . '/../vendor/sensio/framework-extra-bundle/sensio/bundle/frameworkextrabundle/configuration/route.php';
Comments
Post a Comment