【问题标题】:php bin/console make:entity --regenerate App doesn't generate new fieldsphp bin/console make:entity --regenerate App 不生成新字段
【发布时间】:2019-12-01 12:23:32
【问题描述】:

我更新了这个实体,添加了一些字段。

现在我想重新生成 getter 和 setter,但是当我执行 php bin/console make:entity --regenerate App 时没有结果;我的实体是listet,但它说“没有变化”。我尝试过使用 --overwrite 选项的事件。

<?php
namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\Entity(repositoryClass="App\Repository\ProfessionalRepository")
*/
class Professional
{
/**
 * @ORM\Id()
 * @ORM\GeneratedValue()
 * @ORM\Column(type="integer")
 */
private $id;

/**
 * @ORM\Column(type="string", length=255)
 */
private $nom;


/**
 * @ORM\Column(type="boolean")
 */
private $actiu;

/**
 * @ORM\ManyToOne(targetEntity="Especialitat")
 * @ORM\JoinColumn(referencedColumnName="id")
 */
private $especialitat;

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

public function getNom(): ?string
{
    return $this->nom;
}

public function setNom(string $nom): self
{
    $this->nom = $nom;

    return $this;
}

public function getActiu(): ?bool
{
    return $this->actiu;
}

public function setActiu(bool $actiu): self
{
    $this->actiu = $actiu;

    return $this;
}
}

我正在使用 symfony 4.3.8 在以前的版本中,我执行 'php bin/console dictionary:genetrate:entities App',我不确定我是否可以在 symfony 4 中使用这个命令,无论如何它都不起作用。

我不知道还能尝试什么...

【问题讨论】:

    标签: doctrine-orm symfony4 symfony-4.3


    【解决方案1】:

    我已经解决了每次更改后清除缓存的问题。

    php bin/console cache:clear
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-04-27
      • 2021-09-05
      • 2018-07-03
      • 2017-08-04
      • 1970-01-01
      • 2018-09-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多