【发布时间】:2021-06-17 11:30:55
【问题描述】:
我最近使用php bin/console doctorine:generate:entity 创建了一个实体。创建后,我尝试使用php bin/console doctrine:schema:update --force 更新我的架构,但得到以下输出:
Nothing to update - your database is already in sync with the current entity metadata.
我已经尝试过的事情:
php bin/console doctrine:schema:update --dump-sql
同样的输出
php bin/console doctrine:cache:clear-metadata
跑了,但没有任何改变
- 多次清除缓存
什么都没有
php bin/console doctrine:mapping:info
输出: [确定] FOS\UserBundle\Model\Group [确定] FOS\UserBundle\Model\User
相关实体:
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="WeeklyPaymentReport")
*/
class WeeklyPaymentReport
{
/**
* @var int
*
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var int
*
* @ORM\Column(type="integer", nullable=true)
*/
private $bbid;
/**
* @var String
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $request;
/**
* @var \DateTime
*
* @ORM\Column(name="dateOfBirth", type="date", nullable=true)
*/
private $date;
public function getId()
{
return $this->id;
}
public function setBbid($bbid)
{
$this->bbid = $bbid;
return $this;
}
public function getBbid()
{
return $this->bbid;
}
public function setRequest($request)
{
$this->request = $request;
return $this;
}
public function getRequest()
{
return $this->request;
}
public function setDate($date)
{
$this->date = $date;
return $this;
}
public function getDate()
{
return $this->date;
}
}
教义也产生了:
namespace AppBundle\Repository;
/**
* WeeklyPaymentReportRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class WeeklyPaymentReportRepository extends \Doctrine\ORM\EntityRepository
{
}
还有.orm.php:
use Doctrine\ORM\Mapping\ClassMetadataInfo;
$metadata->setInheritanceType(ClassMetadataInfo::INHERITANCE_TYPE_NONE);
$metadata->customRepositoryClassName = 'AppBundle\Repository\WeeklyPaymentReportRepository';
$metadata->setChangeTrackingPolicy(ClassMetadataInfo::CHANGETRACKING_DEFERRED_IMPLICIT);
$metadata->mapField(array(
'fieldName' => 'id',
'type' => 'integer',
'id' => true,
'columnName' => 'id',
));
$metadata->mapField(array(
'columnName' => 'bbid',
'fieldName' => 'bbid',
'type' => 'integer',
));
$metadata->mapField(array(
'columnName' => 'request',
'fieldName' => 'request',
'type' => 'string',
'length' => 255,
));
$metadata->mapField(array(
'columnName' => 'date',
'fieldName' => 'date',
'type' => 'datetime',
));
$metadata->setIdGeneratorType(ClassMetadataInfo::GENERATOR_TYPE_AUTO);
我还能尝试什么?
提前感谢您的帮助!
【问题讨论】:
标签: php symfony doctrine-orm doctrine