0

i installed FOSElasticaBundle using Composer, After that as per the given instruction on https://github.com/FriendsOfSymfony/FOSElasticaBundle i registered FOSElasticaBundle Class in Appkernel.php file, demo code is as following

// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new FOS\ElasticaBundle\FOSElasticaBundle(),
    );
}

But the Problem is after registering new FOS\ElasticaBundle\FOSElasticaBundle(), in the AppKernel.php file. i am trying to run Symfony command from netbeans but it is showing Error

Fatal error: Class 'FOS\ElasticaBundle\FOSElasticaBundle' not found in AppKernel.php file

Please Give me Some Solution for this problem. Thank you

rene
  • 41,474
  • 78
  • 114
  • 152
NGPATEL
  • 92
  • 1
  • 11
  • Which version have you tried installing? Did it get installed in you `vendor` directory after all? – Jovan Perovic Dec 11 '13 at 09:58
  • i installed using "friendsofsymfony/elastica-bundle": "3.0.*@dev". and i have got the elastica-bundle in vendor directory. – NGPATEL Dec 11 '13 at 10:01
  • Try opening file `FOSElasticaBundle`... which namespace is specified? Have you tried running `composer update "friendsofsymfony/elastica-bundle"`? – Jovan Perovic Dec 11 '13 at 12:42
  • thanks i found solution i fixed the issue with declaring it into autoload.php file $loader->add('FOS', __DIR__.'/../vendor/friendsofsymfony/elastica-bundle/FOS'); – NGPATEL Dec 12 '13 at 19:17
  • Which version of Symfony2 are you using? Using `autoload.php` to map namespaces to directories - it sounds to me like 2.0? – Jovan Perovic Dec 12 '13 at 19:43
  • i am using symfony 2.3.7 – NGPATEL Dec 12 '13 at 22:23
  • Sorry about my comment. Maybe sounded a bit rude... wasn't my intention :) Anyhow, it is weird you had to add map namespace manually... – Jovan Perovic Dec 12 '13 at 23:35
  • ... you should probably add the solution yourself. Maybe someone else stumbles upon the same issue ;) – Jovan Perovic Dec 12 '13 at 23:36
  • Why are you using manual mapping in the autoloader? You could use the --optimize-autoloader option in composer install/update commands. You can also use the APC autoloader to boost the autoloading. – castarco Sep 03 '15 at 08:16

1 Answers1

0

I found the solution.

After doing complete configuration of FosElasticaBundle.

Add this line

$loader->add('FOS', DIR.'/../vendor/friendsofsymfony/elastica-bundle/FOS');

into your app/autoloader.php file. that's work for me.

thank you.

NGPATEL
  • 92
  • 1
  • 11