I’m still learning symfony and I ran into a problem i can’t seem to figure out whats causing the problem.
Symfony vs 2.7
newly created bundle
the routing did work before i changed the location to resource: “@AppBundle/Resources/config/routing.yml” so im assuming the bundle is registered. Either case I used a online tutorial but its not working in my case.
error message:
Unable to find file “@AppBundle/Resources/config/routing.yml” in @AppBundle/Resources/config/routing.yml (which is being imported from “/home/rob/webhtdocs/symfony/project2/app/config/routing.yml”). Make sure the “AppBundle” bundle is correctly registered and loaded in the application kernel class. If the bundle is registered, make sure the bundle path “@AppBundle/Resources/config/routing.yml” is not empty.
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 AppBundle\AppBundle(),
);
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
$bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
$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($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
}
}
thanks for the reply back.
I am aware of Github site but not all the familiar as to how to use the github so im going to just delete/recreate the bundle and hope for the best that it works other wise ill be back…
for a php framework that supposed to make things easy it doesn’t make it easy to create and run a new bundle with out a lot running round… lol
Unless you’re pretty familiar with modern design patterns and middleware technologies frameworks are a steep learning curve. Everyone says their sh*t is easy to learn – It never is. Putting that aside Symfony is most definitely one of the top notch PHP frameworks out there. Not to mention Symfony knowledge indirectly translates at least partially to many other projects which make use of the Symfony ecosystem/components. Also Symfony will hand hold you through learning many of the middleware level technologies that just about all php projects are using these days like git (version control) and composer (dependency management). Furthermore, many third party libs are also used like Monolog (logging) and Swiftmailer (mailer) which are used in MANY other projects since they are essentially independent – stand-alone libraries – which can be used in any php context.
You also need to make sure the /app/cache directory is writable by whichever user your system is calling the PHP files with.
And Symfony is a pretty powerful framework. If things go wrong though, and you don’t know where to look or have no idea what is breaking and why, then it is like looking at Mount Everest for the first time and thinking now you’ll have to climb it, even though you really don’t want to. That is the downside of such frameworks. They are magical, when everything works right, and downright massively complex and mysterious, when things go wrong.
To be fair that is the typical experience with anyone else’s code. At least with large community backed projects there is *normally documentation and community support. Unless you’re building something in complete isolation chances are the next person to inherit your code which uses open source technology will hate you much less than had you not.
After having spent a week trying to figure out the causing of the problem; at the end it was the permission setting on the folder(s).
If I’m not mistaken someone did mention permission setting but based on the error message I didn’t think it had anything to do with permission.
The original bundle I created with the help of an online tutorial, didn’t really set any permissions on the folder or folders in question but yet it worked but not so on the second bundle.
So I decided to compare the permission settings with 2 separate ftp sessions and sure enough it was the permission settings on the folder prevented the proper execution application.
It is a permissions problem because, as the PHP user, Symfony at request time tries to build the cache, if the cache directory is empty or outdated. If the folders are built with the wrong permissions or for a user/group that isn’t the PHP user, Symfony balks with the failed to write cache error.