无法在 128 次尝试中为 "value" 生成随机唯一值



我正在定义这个夹具:

ClanmovilPlatformBundleEntityAlias:
    alias_{1..500}:
        name (unique): Alias_<numberBetween(1, 500)>
        description: <text(150)>
        active: <boolean(31)>
        createdAt: <dateTimeThisYear()>
        updatedAt: <dateTimeThisYear()>

我在控制台上收到了这个错误:

[运行时异常]在128次尝试中无法为Clanmovil\PlatformBundle\Entity\Alias:name生成随机唯一值。

我对bundle上的源代码进行了一些研究,但不清楚问题出在哪里。这里出了什么问题?当我发现这样的问题时,我该怎么做?

如果这有助于实体的外观:

namespace ClanmovilPlatformBundleEntity;
use DoctrineORMMapping as ORM;
use ClanmovilPlatformBundleModelIdentifierAutogeneratedTrait;
use SymfonyComponentValidatorConstraints as Assert;
use GedmoTimestampableTraitsTimestampableEntity;
/**
 * @ORMEntity
 * @ORMTable(name="cm_alias",
 *      uniqueConstraints={@ORMUniqueConstraint(name="name", columns={"name"})},
        indexes={@ORMIndex(name="fulltext_idx",
            columns={"name"},
            flags={"fulltext"})})
 * )
 */
class Alias
{
    use IdentifierAutogeneratedTrait;
    use TimestampableEntity;
    /**
     * @var string
     * @ORMColumn(type="string", length=150)
     * @AssertNotBlank()
     */
    protected $name;
    /**
     * @var string
     * @ORMColumn(type="text", nullable=true)
     */
    protected $description;
    /**
     * @var bool
     * @ORMColumn(type="boolean")
     */
    protected $active = true;
    /**
     * @ORMManyToMany(targetEntity="Command", mappedBy="command_alias", cascade={"persist"})
     */
    protected $alias_command;

    /**
     * Set name.
     *
     * @param string $name
     * @return Alias
     */
    public function setName($name)
    {
        $this->name = $name;
        return $this;
    }
    /**
     * Get name.
     *
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }
    /**
     * Set description.
     *
     * @param string $description
     *
     * @return Alias
     */
    public function setDescription($description)
    {
        $this->description = $description;
        return $this;
    }
    /**
     * Get description.
     *
     * @return string
     */
    public function getDescription()
    {
        return $this->description;
    }
    /**
     * Set active.
     *
     * @param bool $active
     *
     * @return Category
     */
    public function setActive($active)
    {
        $this->active = $active;
        return $this;
    }
    /**
     * Get active.
     *
     * @return bool
     */
    public function getActive()
    {
        return $this->active;
    }
    /**
     * Get command for alias
     *
     * @return string
     */
    public function getAliasCommand()
    {
        return $this->alias_command;
    }
    public function __toString()
    {
        return $this->name;
    }
}

我不知道这是否是最好的解决方案,但到目前为止,我已经通过增加随机数的数量来解决这个问题:

name (unique): Alias_<numberBetween(1, 1000)>

相关内容

  • 没有找到相关文章

最新更新