Doctrine和Symfony自动生成db表

时间:2014-11-10 18:13:38

标签: php mysql symfony doctrine-orm doctrine

我手动编写了下面的代码,在shell中执行命令后创建了db表,但是在db中只创建了没有列的空表(name =“lcl_user”)。

namespace Stefano\ZulliBundle\Entity;

use FOS\UserBundle\Model\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;

/**
* @ORM\Entity(repositoryClass="Stefano\ZulliBundle\Repository\UserRepository")
* @ORM\Table(name="lcl_user")
*/
class User extends BaseUser
{
/**
 * @ORM\Id
 * @ORM\Column(type="integer")
 * @ORM\GeneratedValue(strategy="AUTO")
 */
protected $id;

/** @ORM\Column(name="facebook_id", type="string", length=255, nullable=true) */
protected $facebook_id;

/** @ORM\Column(name="facebook_access_token", type="string", length=255, nullable=true) */
protected $facebook_access_token;

/** @ORM\Column(name="google_id", type="string", length=255, nullable=true) */
protected $google_id;

/** @ORM\Column(name="google_access_token", type="string", length=255, nullable=true) */
protected $google_access_token;


//YOU CAN ADD MORE CODE HERE !
}

我执行的命令shell是:

php app/console doctrine:schema:update --force

0 个答案:

没有答案