0

私は別のものを作成しました。generalBundleそれはエンティティModelをバンドルします。EntitystoreBundle

app/console doctrine:schema:update --force

コマンドはgeneralBundleフィールドを作成しません。追加で作成されたフィールドのみを作成しますstoreBundle。どこが間違っているのかわかりません。誰か提案できますか?

私のgeneralBundleモデルクラスには

namespace ste\GeneralBundle\Model;

use DateTime;

abstract class Share 
{
    protected $id;
    protected $user;
    protected $comment;

    public function __construct()
    {
        $this->setCreatedAt(new \DateTime());
        $this->setUpdatedAt(new \DateTime());
    }

    public function getId()
    {
        return $this->id;
    }



    public function setComment($comment)
    {
        $this->comment = $comment;
    }


    public function getComment()
    {
        return $this->comment;
    }
}

私のgeneralBundleエンティティクラスには

    namespace ste\ActivityBundle\Entity;

    use ste\GeneralBundle\Model\Share as BaseShare;


    class Share extends BaseShare
    {

    }

そして最後に、私のStoreBundleエンティティクラスには

namespace ste\StoreBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Doctrine\Common\Collections\ArrayCollection;
use ste\GeneralBundle\Entity\Share as BaseShare;

    /**
     * ste\StoreBundle\Entity\Share
     *
     * @ORM\Table(name="shares")
     */
    class Share extends BaseShare
    {
        /** 
         * @var integer $id
         *
         * @ORM\Column(name="id", type="integer", nullable=false)
         * @ORM\Id
         * @ORM\GeneratedValue(strategy="IDENTITY")
         */
        protected $id;
    }

私が次のようなエラーを受け取ったので、ここprotected $id;に提出されたものは後で追加されます

No identifier/primary key specified for Entity "ste\StoreBundle\Entity\Share" sub class of "ste\GeneralBundle\Entity\Share". Every Enti  
  ty must have an identifier/primary key.  

そして私のGeneralBundle > Resources> Config >Doctrinecontainファイルには以下が含まれていますShare.orm.xml

<?xml version="1.0" encoding="UTF-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
                  http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">

    <entity name="ste\GeneralBundle\Entity\Share" table="share">

        <id name="id" column="id" type="integer">
            <generator strategy="AUTO" />
        </id>

        <field name="user" column="user_id" type="integer" />


        <field name="comment" column="comment" type="string" length="255" />


    </entity>

</doctrine-mapping>

他の構成は行われません。手がかりはありますか?追加するものはありDependencyInjectionますか?

4

1 に答える 1

0

config.yml私は答えを得ました。私はこれらの行に追加する必要があります:

orm:
        entity_managers:
            default:
                mappings:
                   steStoreBundle: ~
                   steGeneralBundle: ~

私の場合以外は別バンドルなのでStoreBundle

于 2013-02-19T14:31:13.873 に答える