3

我在奏鸣曲管理员中更改文档的父级时遇到问题。

我的文档有这样的属性:

 /**
 * @PHPCRODM\Children(filter="teaserimage*", cascade="persist")
 * @var Image[]
 */
protected $teaserImages;
....
/**
 * @Validation\PhpcrImage(maxWidth="1500", maxHeight="844", minWidth="600", minHeight="338", minRatio="1.77", maxRatio="1.78", nullable=false)
 *
 * @return Image|null
 */
public function getTeaserImage()
{
   return $this->getLocalizedImage($this->teaserImages, 'teaserimage');
}

/**
 * @param Image $image
 */
public function setTeaserImage($image)
{
    $this->teaserImages->add(
        self::setupImage($image, $this->getLocalizedImageNodeName('teaserimage'), $this->getTeaserImage())
    );
}

当我尝试更改任何文章文档的父级时,我收到了类似的错误

The server returned a "500 Internal Server Error".

The Id is immutable (/cms/content/blog/blog-post-for-12th-october/teaserimage_de.jpg !== /cms/content/blog/blog-post-for-12th-october). Please use DocumentManager::move to move the document: blog post for 12th October (/cms/content/blog/blog-post-for-12th-october)

尽管发生此错误,但我的文档已与所有子文档一起移动到正确的位置。

这就是我的文档的样子 https://gist.github.com/milosnovi/a83f400c8ff06b4de6dd96e1f149a8dd

4

1 回答 1

0

检查您的 preUpdated、prePersists 方法。当更改是父更改时,您不应该在这些方法中刷新对象。

于 2017-05-02T13:45:01.807 回答