【问题标题】:Gedmo/Sluggable storing numbers instead of stringGedmo/Sluggable 存储数字而不是字符串
【发布时间】:2014-03-04 10:18:52
【问题描述】:

我已经使用 sluggable 学说扩展有一段时间了,但突然它开始存储数字而不是预期的字符串。在创建 slug 的那一刻似乎没有字符串。

这是文件的摘录

<?php

namespace YourPower\EventBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\HttpFoundation\File\File;

/**
 * YourPower\EventBundle\Entity\EventTag
 *
 * @ORM\Table()
 * @ORM\Entity(repositoryClass="YourPower\EventBundle\Entity\EventTagRepository")
 * @ORM\HasLifecycleCallbacks()
 */
class EventTag
{
    /**
     * @var integer $id
     *
     * @ORM\Column(name="id", type="integer", nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */

private $id;

/**
 * @var tag
 *
 * @ORM\Column(type="string", length=100, nullable=false)
 * @Assert\NotBlank()
 */
private $tag;

/**
 * @var string $url
 * @Gedmo\Slug(fields={"tag"})
 * @ORM\Column(type="string", length=100, nullable=false, unique=true)
 */
private $url = '';

多年来我没有对此文件进行任何更改...所以我不认为我搞砸了。我检查了包的提交日志和学说扩展但无济于事:-(谷歌也帮不了我。

有人知道导致这种新行为的原因是什么吗?

UPD:回到 DoctrineExtensions 的 2.3.7 版本解决了这个问题……奇怪的是似乎没有其他人受到影响……

【问题讨论】:

  • 能否请您添加您的发现/解决方案作为答案?
  • @nifr 我会尽快找到解决方案

标签: symfony doctrine-orm symfony-2.3 slug


【解决方案1】:

解决方案似乎是将 Gedmo/DoctrineExtensions 恢复到 2.3.7 版本。
在 2.3.7 和 2.3.8 之间,对 Sluggable 功能进行了一些重大重构,导致字符串丢失。

然而,我不清楚为什么它似乎不会影响其他用户,因为没有可用的信息。

【讨论】:

    猜你喜欢
    • 2022-12-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-04
    • 1970-01-01
    • 2011-06-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多