Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/symfony/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Symfony 3.3架构验证错误_Php_Symfony_Doctrine_Schema - Fatal编程技术网

Php Symfony 3.3架构验证错误

Php Symfony 3.3架构验证错误,php,symfony,doctrine,schema,Php,Symfony,Doctrine,Schema,我有两个实体,如下所示: <?php // src/coreBundle/Entity/model.php namespace coreBundle\Entity; use Doctrine\ORM\Mapping as ORM; use coreBundle\Entity\brand; /** *@ORM\Entity *@ORM\Table(name="model") */ class model { /** * @ORM\ManyToOne(targetEntity

我有两个实体,如下所示:

<?php
// src/coreBundle/Entity/model.php
namespace coreBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use coreBundle\Entity\brand;

/**
*@ORM\Entity
*@ORM\Table(name="model")
*/
class model
{
    /**
    * @ORM\ManyToOne(targetEntity="coreBundle\Entity\brand", inversedBy="models")
    * @ORM\JoinColumn(name="brand_id", referencedColumnName="id")
    */
    private $brands;


    /**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
    public $id;

/**
    *@ORM\Column(type="integer")
    */
    public $brand_id;


    /**
    *@ORM\Column(type="string", length=100)
    */
    private $name;

    /**
    *@ORM\Column(type="string", length=100)
    */
    private $image_url;

    /**
    *@ORM\Column(type="string", length=200)
    */
    private $comment;

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

    /**
     * Set brandId
     *
     * @param integer $brandId
     *
     * @return model
     */
    public function setBrandId($brandId)
    {
        $this->brand_id = $brandId;

        return $this;
    }

    /**
     * Get brandId
     *
     * @return integer
     */
    public function getBrandId()
    {
        return $this->brand_id;
    }

    /**
     * Set name
     *
     * @param string $name
     *
     * @return model
     */
    public function setName($name)
    {
        $this->name = $name;

        return $this;
    }

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

    /**
     * Set imageUrl
     *
     * @param string $imageUrl
     *
     * @return model
     */
    public function setImageUrl($imageUrl)
    {
        $this->image_url = $imageUrl;

        return $this;
    }

    /**
     * Get imageUrl
     *
     * @return string
     */
    public function getImageUrl()
    {
        return $this->image_url;
    }

    /**
     * Set comment
     *
     * @param string $comment
     *
     * @return model
     */
    public function setComment($comment)
    {
        $this->comment = $comment;

        return $this;
    }

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



    /**
     * Set brands
     *
     * @param \coreBundle\Entity\brand $brands
     *
     * @return model
     */
    public function setBrands(\coreBundle\Entity\brand $brands = null)
    {
        $this->brands = $brands;

        return $this;
    }

    /**
     * Get brands
     *
     * @return \coreBundle\Entity\brand
     */
    public function getBrands()
    {
        return $this->brands;
    }
}
<?php
// src/coreBundle/Entity/brand.php
namespace coreBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use coreBundle\Entity\model;
use Doctrine\Common\Collections\ArrayCollection;

/**
*@ORM\Entity
*@ORM\Table(name="brand")
*/
class brand
{
    /**
     * ORM\OneToMany(targetEntity="coreBundle\Entity\model", mappedBy="brands")
     */
    private $models;
    public function __construct()
    {
        $this->models = new ArrayCollection();
    }

    /**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
public $id;

    /**
    *@ORM\Column(type="string", length=100)
    */
    private $name;



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

    /**
     * Set name
     *
     * @param string $name
     *
     * @return brand
     */
    public function setName($name)
    {
        $this->name = $name;

        return $this;
    }

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

如果你在3个小时的痛苦之后仍然感到疑惑,那么你错过了
@ORM\OneToMany
(brand.php)中的
@

非常感谢。