2014년 12월 1일 월요일

The class 'fuar\sergiBundle\Entity\Product' was not found in the chain configured namespaces error

Mongodb is runnig . I don't understand what is the problem. Please help me!

app/config.yml

doctrine_mongodb:
    connections:
        default:
            server: mongodb://localhost:27017
            options: {}
    default_database: test_database
    document_managers:
        default:
            auto_mapping: true

Controller

namespace fuar\sergiBundle\Controller;

use fuar\sergiBundle\Entity\Product;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;


class DefaultController extends Controller
{
    public function indexAction()
    {
        $product = new Product();
        $product->setName("xxx");
        $product->setAge('25');
        $product->setSchool("xxxx");
        
        $dm = $this->get('doctrine_mongodb')->getManager();
        $dm->persist($product);
        $dm->flush();
        
         return new Response('Created product id '.$product->getId());
    }
}


fuar/sergiBundle/Entity/Product.php

namespace fuar\sergiBundle\Entity;

use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB;

/**
 * Product
 */
class Product
{
    /**
     * @var integer
     */
    private $id;

    /**
     * @var string
     */
    private $name;



Cross-referencing this with: https://github.com/doctrine/DoctrineMongoDBBundle/issues/275, which has been answered.


댓글 없음:

댓글 쓰기