Класс не найден в настроенных цепочках пространств имен symfony2 usimg MongoDb

Я создал документ вручную и попытался сохранить данные, используя persist.its показывает мне следующую ошибку.

The class 'Kdm\\SettingBundle\\Document\\Discount' was not found in the chain configured namespaces FOS\\UserBundle\\Entity, Ivory\\GoogleMapBundle\\Entity at
/var/www/project/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/MappingException.php:37)"}

Вот мой файл документа Discount.php

<?php
namespace Kdm\SettingBundle\Document;

use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Validator\Constraints as Assert;


/**
* Discount
* @MongoDB\Document(repositoryClass="Kdm\SettingBundle\Repository\SettingRepository")
*/

class Discount
{
/**
* @MongoDB\Id(strategy="auto")
*/
protected $id;

/**
* @MongoDB\Field(type="integer")
*/
protected $value;


/**
* Get id
*
* @return string $id
*/
public function getId()
{
return $this->id;
}



/**
* @param integer $value
*/
public function setValue($value)
{
$this->value = $value;
}

/**
* @return integer
*/
public function getValue()
{
return $this->value;
}
}

Вот мой SettingController.php

<?php
namespace Kdm\SettingBundle\Controller;

use Kdm\KdmBundle\Controller\RefController as KdmController;
use Kdm\SettingBundle\Document\Discount as Setting;
use Symfony\Component\HttpFoundation\Request;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;

/**
* @Route("/setting")
*/
class SettingController extends KdmController
{
/**
* Constructor
*/
public function __construct()
{
parent::__construct('Kdm', 'Setting', 'setting','Discount');
}

/**
* @Route
* (
*      path="/",
*      name="kdm_setting"* )
* @Template("::KdmSetting/Front/index.html.twig")
*/
public function indexAction()
{
$setting = new Setting();
$setting->setValue('5');

$em = $this->getDoctrine()->getManager();
$em->persist($setting);
$em->flush();

$form = $this->createFormBuilder($setting)
->add('value','integer')
->add('save','submit')
->getForm();


return array(
'form' => $form->createView()
);
}
}

я пытаюсь решить эту ошибку с последних 2 дней 🙁 Вы можете помочь?

0

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector