【问题标题】:The table with name 'controlling_tool.customer_group_text' already exists名称为“controlling_tool.customer_group_text”的表已存在
【发布时间】:2013-04-23 07:53:51
【问题描述】:

我正在使用 DOCTRINE2CodeIgniter 2。我对此很陌生。 我试图从实体生成mysqltables,但我总是收到此错误 [Doctrine\DBAL\Schema\SchemaException]
名称为“controlling_tool.customer_group_text”的表已存在
我没有使用同一实体的 2 个项目。 数据库是空的,即使我尝试删除它,这个过程也不起作用。 你能解释一下吗

namespace Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Entity\CustomerGroupText
 *
 * @Entity(repositoryClass="CustomerGroupTextRepository")
 * @Table(name="customer_group_text", indexes={@Index(name="fk_status_idx", columns={"customer_group_id"}), @Index(name="fk_language_idx", columns={"language_id"})})
 */
class CustomerGroupText
{
    /**
     * @Id
     * @Column(type="string", length=5)
     */
    protected $customer_group_id;

    /**
     * @Column(type="string", length=45, nullable=true)
     */
    protected $description;

    /**
     * @ManyToOne(targetEntity="CustomerGroup", inversedBy="customerGroupTexts")
     * @JoinColumn(name="customer_group_id", referencedColumnName="id", nullable=false)
     */
    protected $customerGroup;

    /**
     * @ManyToOne(targetEntity="Language", inversedBy="customerGroupTexts")
     * @JoinColumn(name="language_id", referencedColumnName="id_language_id", nullable=false)
     */
    protected $language;

    public function __construct()
    {
    }

    /**
     * Set the value of customer_group_id.
     *
     * @param string $customer_group_id
     * @return Entity\CustomerGroupText
     */
    public function setCustomerGroupId($customer_group_id)
    {
        $this->customer_group_id = $customer_group_id;

        return $this;
    }

    /**
     * Get the value of customer_group_id.
     *
     * @return string
     */
    public function getCustomerGroupId()
    {
        return $this->customer_group_id;
    }

    /**
     * Set the value of description.
     *
     * @param string $description
     * @return Entity\CustomerGroupText
     */
    public function setDescription($description)
    {
        $this->description = $description;

        return $this;
    }

    /**
     * Get the value of description.
     *
     * @return string
     */
    public function getDescription()
    {
        return $this->description;
    }

    /**
     * Set CustomerGroup entity (many to one).
     *
     * @param Entity\CustomerGroup $customerGroup
     * @return Entity\CustomerGroupText
     */
    public function setCustomerGroup(CustomerGroup $customerGroup = null)
    {
        $this->customerGroup = $customerGroup;

        return $this;
    }

    /**
     * Get CustomerGroup entity (many to one).
     *
     * @return Entity\CustomerGroup
     */
    public function getCustomerGroup()
    {
        return $this->customerGroup;
    }

    /**
     * Set Language entity (many to one).
     *
     * @param Entity\Language $language
     * @return Entity\CustomerGroupText
     */
    public function setLanguage(Language $language = null)
    {
        $this->language = $language;

        return $this;
    }

    /**
     * Get Language entity (many to one).
     *
     * @return Entity\Language
     */
    public function getLanguage()
    {
        return $this->language;
    }

    public function __sleep()
    {
        return array('customer_group_id', 'language_id', 'description');
    }
}

【问题讨论】:

    标签: php codeigniter doctrine


    【解决方案1】:

    只需尝试清除您的 codeigniter 项目缓存。我认为它正在尝试从那里读取配置详细信息。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-10-21
      • 1970-01-01
      • 2018-10-27
      • 2017-08-31
      • 1970-01-01
      • 1970-01-01
      • 2011-10-07
      相关资源
      最近更新 更多