Symfony2没有要处理的元数据类 [英] Symfony2 No Metadata Classes to process
问题描述
php应用程序/控制台原则:schema:update - 强制
我用控制台工具创建实体
php app / console doctrine:generate:entity
我的实体类是:
<?php
命名空间ISLab\AdminBundle\Entity;
使用Doctrine\ORM\Mapping作为ORM;
/ **
* @ ORM\Entity(repositoryClass =ISLab\AdminBundle\Entity\MenuItemRepository)
* @ ORM\Table(name = menu_items)
* /
class MenuItem
{
/ **
* @ ORM\Column(name =id,type =integer )
* @ ORM\Id
* @ ORM\GeneratedValue(strategy =AUTO)
* /
private $ id;
/ **
* @ ORM\Column(name =parent,type =integer)
* /
private $ parent;
/ **
* @ ORM\Column(name =type,type =integer)
* /
private $ type;
/ **
* @ ORM\Column(name =name,type =string,length = 255)
* /
private $名称;
/ **
* @ ORM\Column(name =status,type =integer)
* /
private $ status;
/ **
* @ ORM\Column(name =route,type =string,length = 255)
* /
private $路线;
/ **
* @ ORM\Column(name =options,type =text)
* /
private $ options;
// ---> geter和setter
另一个:
<?php
命名空间ISLab\AdminBundle\Entity;
使用Doctrine\ORM\Mapping作为ORM;
/ **
* @ ORM\Entity(repositoryClass =ISLab\AdminBundle\Entity\MenuTypeRepository)
* @ ORM\Table(name = menu_types)
* /
class MenuType
{
/ **
* @ ORM\Column(name =id,type =integer )
* @ ORM\Id
* @ ORM\GeneratedValue(strategy =AUTO)
* /
private $ id;
/ **
* @ ORM\Column(name =name,type =string,length = 255)
* /
private $名称;
/ **
* @ ORM\Column(name =description,type =text)
* /
private $ description;
像这样,我创建了所有的实体,一切都很好,但现在idk如何symfony / doctrine找不到我的元数据。哪里有问题以及如何解决?
我有一个类似的问题,花了我一段时间,直到我知道如何清除缓存。只清除教义的缓存对我来说没有效果。使用以下命令清除整个环境(在这种情况下生产一个)
php app / console cache:clear --env = prod
I have problem with Symfony2 and Entites. I already do this so many times and never before get this error when try to use
php app/console doctrine:schema:update --force
I create entity with console tool
php app/console doctrine:generate:entity
My Entity Class is:
<?php
namespace ISLab\AdminBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="ISLab\AdminBundle\Entity\MenuItemRepository")
* @ORM\Table(name="menu_items")
*/
class MenuItem
{
/**
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(name="parent", type="integer")
*/
private $parent;
/**
* @ORM\Column(name="type", type="integer")
*/
private $type;
/**
* @ORM\Column(name="name", type="string", length=255)
*/
private $name;
/**
* @ORM\Column(name="status", type="integer")
*/
private $status;
/**
* @ORM\Column(name="route", type="string", length=255)
*/
private $route;
/**
* @ORM\Column(name="options", type="text")
*/
private $options;
// ---> geter and setter
And another one:
<?php
namespace ISLab\AdminBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="ISLab\AdminBundle\Entity\MenuTypeRepository")
* @ORM\Table(name="menu_types")
*/
class MenuType
{
/**
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(name="name", type="string", length=255)
*/
private $name;
/**
* @ORM\Column(name="description", type="text")
*/
private $description;
Like this i create all my entities after this and all be good, but now idk how symfony/doctrine cant found my metadata. Where is problem and how to slove this?
I had a similar problem and took me a while until I find out how to clear out the cache. Clearing only doctrine's cache did not work for me. Use the command below to clear the entire environment (production one in this case)
php app/console cache:clear --env=prod
这篇关于Symfony2没有要处理的元数据类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!