1
,所以我設置一個Bundle至極被稱爲礦:致命錯誤:類未找到
src/Mine/DemoBundle/Controller
src/Mine/DemoBundle/Entity/user/User.php
我的路由是:
defaults: { _controller: MineDemo:User:create }
UserController.php開始是這樣的:
namespace Mine\DemoBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Mine\DemoBundle\Entity\User;
class UserController extends Controller
{
public function createAction()
{
$user = new User();
$user->setName('Jonathan H. Wage');
$em = $this->get('doctrine.orm.entity_manager');
$em->persist($user);
$em->flush();
// ...
}
和User.php是:
namespace Mine\DemoBundle\Entity\User;
/**
* Mine\DemoBundle\Entity\User\User
*/
class User
{
/**
* @var integer $id
*/
private $id;
/**
* @var string $name
*/
private $name;
/**
* Get id
*
* @return integer $id
*/
public function getId()
{
return $this->id;
}
/**
* Set name
*
* @param string $name
*/
public function setName($name)
{
$this->name = $name;
}
/**
* Get name
*
* @return string $name
*/
public function getName()
{
return $this->name;
}
}
我不斷收到錯誤:
Fatal error: Class 'Mine\DemoBundle\Entity\User' not found
in C:\xampp\htdocs\Symfony\src\Mine\DemoBundle\Controller\UserController.php on line 12
感謝您的幫助