学说方案更新。俯瞰实体

时间:2015-12-12 21:57:34

标签: php symfony doctrine-orm doctrine

我创建了2个新实体,当我运行时

app/console doctrine:schema:update --force

它说我是最新的,这两个新实体不会创建表。

我找到的每个其他命令都会检测其他捆绑包中的实体,但是我正在处理的捆绑包中没有。例子是

app/console doctrine:mapping:info

它也没有显示。

这是一个例子。它存在于我的包的实体文件夹中

<?php

namespace test\OrganizationBundle\Entity;

use Symfony\Component\Validator\Constraints as Assert;
use Doctrine\ORM\Mapping as ORM;

/**
 * Department
 * @ORM\Entity
 * @ORM\Table(name="departments")
 */
class Department
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="bigint", nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $id;

    /**
     * @var string
      * 
     * @ORM\Column(name="name", type="string", length=50, nullable=false)
     */
    private $name;

    /**
     * @var integer
     * @ORM\Column(name="facilityId", type="int")
     *
     */
    private $facilityId;

    /**
     * @var \DateTime
     * @ORM\Column(name="created", type="datetime")
     */
    private $created;

    /**
     * @var \DateTime
     * @ORM\Column(name="updated", type="datetime")
     */
    private $updated;

    /**
     * @var array
     * @ORM\ManyToMany(targetEntity="DeptTag", mappedBy="departments")
     */
    private $deptTags;



     public function __construct()
      {
        $this->deptTags = new ArrayCollection();
      }

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

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

        return $this;
    }

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

    /**
     * Set facilityId
     *
     * @param string $facilityId
     *
     * @return Department
     */
    public function setFacilityId($facilityId)
    {
        $this->facilityId = $facilityId;

        return $this;
    }

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

    /**
     * Set created
     *
     * @param \DateTime $created
     *
     * @return Department
     */
    public function setCreated($created)
    {
        $this->created = $created;

        return $this;
    }

    /**
     * Get created
     *
     * @return \DateTime
     */
    public function getCreated()
    {
        return $this->created;
    }

    /**
     * Set updated
     *
     * @param \DateTime $updated
     *
     * @return Department
     */
    public function setUpdated($updated)
    {
        $this->updated = $updated;

        return $this;
    }

    /**
     * Get updated
     *
     * @return \DateTime
     */
    public function getUpdated()
    {
        return $this->updated;
    }

    /**
     * Set deptTags
     *
     * @param array $deptTags
     *
     * @return Department
     */
    public function setDeptTags($deptTags)
    {
        $this->deptTags = $deptTags;

        return $this;
    }

    /**
     * Get deptTags
     *
     * @return array
     */
    public function getDeptTags(DeptTag)
    {
        return $this->deptTags[] = $deptTag;
    }
}

0 个答案:

没有答案