Reputation: 11
given is my appKernel class while registering the bundles it is sing to generate the classes
new FOS\RestBundle\FOSRestBundle(),
new JMS\SerializerBundle\JMSSerializerBundle(),
new Nelmio\CorsBundle\NelmioCorsBundle(),
but i used following commands to generate them from composer
composer require friendsofsymfony/rest-bundle
composer require jms/serializer-bundle
composer require nelmio/cors-bundle
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = [
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 Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new AppBundle\AppBundle(),
new FOS\RestBundle\FOSRestBundle(),
new JMS\SerializerBundle\JMSSerializerBundle(),
new Nelmio\CorsBundle\NelmioCorsBundle(),
];
if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
$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;
}
while running my php code it is giving exceptions because given bundles are not register
Upvotes: 1
Views: 77
Reputation: 35139
There will also be some configuration for them all in a config file. Often in app/config/config.yml
. Even if it will all be the default, they need to be fully enabled by that entry in the configuration (yml, or xml).
You can see the sample (and complete, with all defaults) with the command bin/console debug:config JMSSerializerBundle
, replacing the bundle-name as appropriate.
There is a page of details for JMSSerializer and similar exist for the others.
Upvotes: 0
Reputation: 790
run the command and clear cache:
php bin/console cache:clear
also add the use classes at top AppKernel.php
Upvotes: 1