0

由于某种原因,我的所有实体都不是在数据库中创建的。跑步时php app\console doctrine:schema:create --dump-sql。输出显示了一些表的创建,但不是全部。我缺少一个MeetingGroup表单 PastonVerBundle

教义配置:

# Doctrine Configuration
doctrine:
    dbal:
        driver:   %database_driver%
        host:     %database_host%
        port:     %database_port%
        dbname:   %database_name%
        user:     %database_user%
        password: %database_password%
        charset:  UTF8
        types:
            json: Sonata\Doctrine\Types\JsonType

    orm:
        auto_generate_proxy_classes: %kernel.debug%
        #auto_mapping: true
        entity_managers:
            default:
                mappings:
                    ApplicationSonataUserBundle: ~
                    SonataUserBundle: ~    
                    FOSUserBundle: ~
                    SonataNotificationBundle: ~
                    PastonVerBundle: ~

输出:

CREATE TABLE fos_user_group (
    id INT AUTO_INCREMENT NOT NULL,
    name VARCHAR(255) NOT NULL,
    roles LONGTEXT NOT NULL COMMENT '(DC2Type:array)',
    UNIQUE INDEX UNIQ_58 3D1F3E5E237E06 (name),
    PRIMARY KEY(id)) ENGINE = InnoDB;

CREATE TABLE fos_user_user (
    id INT AUTO_INCREMENT NOT NULL,
    username VARCHAR(255 ) NOT NULL,
    username_canonical VARCHAR(255) NOT NULL,
    email VARCHAR(255) NOT NULL,
    email_canonical VARCHAR(255) NOT NULL,
    enabled TINYINT(1) NOT NULL,
    salt VARC HAR(255) NOT NULL,
    password VARCHAR(255) NOT NULL,
    last_login DATETIME DEFAULT NULL,
    locked TINYINT(1) NOT NULL,
    expired TINYINT(1) NOT NULL,
    expires_at DATETIM E DEFAULT NULL,
    confirmation_token VARCHAR(255) DEFAULT NULL,
    password_requested _at DATETIME DEFAULT NULL,
    roles LONGTEXT NOT NULL COMMENT '(DC2Type:array)',
    cr edentials_expired TINYINT(1) NOT NULL,
    credentials_expire_at DATETIME DEFAULT NULL,
    created_at DATETIME NOT NULL,
    updated_at DATETIME NOT NULL,
    date_of_birth DA TETIME DEFAULT NULL,
    firstname VARCHAR(64) DEFAULT NULL,
    lastname VARCHAR(64) DE FAULT NULL,
    website VARCHAR(64) DEFAULT NULL,
    biography VARCHAR(255) DEFAULT NULL,
    gender VARCHAR(1) DEFAULT NULL,
    locale VARCHAR(8) DEFAULT NULL,
    timezone VARC HAR(64) DEFAULT NULL,
    phone VARCHAR(64) DEFAULT NULL,
    facebook_uid VARCHAR(255) DEFAULT NULL,
    facebook_name VARCHAR(255) DEFAULT NULL,
    facebook_data LONGTEXT DE FAULT NULL,
    twitter_uid VARCHAR(255) DEFAULT NULL,
    twitter_name VARCHAR(255) DEFAULT NULL,
    twitter_data LONGTEXT DEFAULT NULL,
    gplus_uid VARCHAR(255) DEFAULT NULL,
    gplus_name VARCHAR(255) DEFAULT NULL,
    gplus_data LONGTEXT DEFAULT NULL,
    toke n VARCHAR(255) DEFAULT NULL,
    two_step_code VARCHAR(255) DEFAULT NULL,
    UNIQUE IND EX UNIQ_C560D76192FC23A8 (username_canonical),
    UNIQUE INDEX UNIQ_C560D761A0D96FB F (email_canonical),
    PRIMARY KEY(id)) ENGINE = InnoDB; 

CREATE TABLE fos_user_user_group (
    user_id INT NOT NULL, group_id INT NOT NULL,
    INDEX IDX_B3C77447A76ED395 (user_id),
    INDEX IDX_B3C77447FE54D947 (group_id),
    PRIMARY KEY(user_id, group_id)) 
    ENGINE = InnoDB; 

CREATE TABLE notification__message (
    id INT AUTO_INCREMENT NOT NULL,
    type VARCHAR (255) NOT NULL,
    body LONGTEXT NOT NULL,
    state INT NOT NULL,
    created_at DATETIME NOT NULL,
    updated_at DATETIME DEFAULT NULL,
    started_at DATETIME DEFAULT NULL,
    co mpleted_at DATETIME DEFAULT NULL,
    INDEX state (state),
    INDEX createdAt (created_ at),
    PRIMARY KEY(id)) ENGINE = InnoDB;

ALTER TABLE fos_user_user_group ADD CONSTRAINT FK_B3C77447A76ED395 FOREIGN KEY ( user_id) REFERENCES fos_user_user(id); 
ALTER TABLE fos_user_user_group ADD CONSTRAINT FK_B3C77447FE54D947 FOREIGN KEY ( group_id) REFERENCES fos_user_group(id)

实体:

<?php

namespace Paston\VerBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Paston\VerBundle\Entity\MeetingGroup
 *
 * @ORM\Table()
 * @ORM\Entity(repositoryClass="Paston\VerBundle\Entity\MeetingGroupRepository")
 */
class MeetingGroup
{
    /**
     * @var integer $id
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

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

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

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

    /**
     * @var boolean $deleted
     *
     * @ORM\Column(name="deleted", type="boolean")
     */
    private $deleted;

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


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

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

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

    /**
     * Set pattern
     *
     * @param string $pattern
     */
    public function setPattern($pattern)
    {
        $this->pattern = $pattern;
    }

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

    /**
     * Set creationDate
     *
     * @param datetime $creationDate
     */
    public function setCreationDate($creationDate)
    {
        $this->creationDate = $creationDate;
    }

    /**
     * Get creationDate
     *
     * @return datetime 
     */
    public function getCreationDate()
    {
        return $this->creationDate;
    }

    /**
     * Set deleted
     *
     * @param boolean $deleted
     */
    public function setDeleted($deleted)
    {
        $this->deleted = $deleted;
    }

    /**
     * Get deleted
     *
     * @return boolean 
     */
    public function getDeleted()
    {
        return $this->deleted;
    }

    /**
     * Set number
     *
     * @param integer $number
     */
    public function setNumber($number)
    {
        $this->number = $number;
    }

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

doctrine:mapping:info也不显示MeetingGroup

`
Found 7 entities mapped in entity manager default:
[OK]   Application\Sonata\UserBundle\Entity\Group
[OK]   Application\Sonata\UserBundle\Entity\User
[OK]   Sonata\UserBundle\Entity\BaseGroup
[OK]   Sonata\UserBundle\Entity\BaseUser
[OK]   FOS\UserBundle\Entity\Group
[OK]   FOS\UserBundle\Entity\User
[OK]   Sonata\NotificationBundle\Entity\Message
`
4

1 回答 1

-1

Hat 将类转换为 XML 而不是 Annotation。

于 2012-06-25T12:05:35.937 回答