Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
479 views
in Technique[技术] by (71.8m points)

doctrine-orm - php bin /控制台make:entity --regenerate应用程序不会生成新字段(php bin/console make:entity --regenerate App doesn't generate new fields)

I updated this entity adding some fields.

(我更新了该实体并添加了一些字段。)

Now I'd like to regenerate getters and setters but whe I execute php bin/console make:entity --regenerate App I have no results;

(现在我想重新生成getter和setter,但是当我执行php bin/console make:entity --regenerate App我没有结果;)

my entites are listet but it says "no change".

(我的实体是listet,但上面写着“没有变化”。)

I'v tried event with --overwrite option.

(我用--overwrite选项尝试了事件。)

<?php
namespace AppEntity;

use DoctrineORMMapping as ORM;

/**
* @ORMEntity(repositoryClass="AppRepositoryProfessionalRepository")
*/
class Professional
{
/**
 * @ORMId()
 * @ORMGeneratedValue()
 * @ORMColumn(type="integer")
 */
private $id;

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


/**
 * @ORMColumn(type="boolean")
 */
private $actiu;

/**
 * @ORMManyToOne(targetEntity="Especialitat")
 * @ORMJoinColumn(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;
}
}

I'm using symfony 4.3.8 In previous versions I did it executring 'php bin/console doctrine:genetrate:entities App', I'm not sure if I can use this command in symfony 4, anyway it neither doesn't work.

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

I'm don't know what else to try...

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

  ask by Oriol Planas translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

php bin/console cache:clear

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...