【发布时间】:2016-10-12 08:23:31
【问题描述】:
我正在使用 nelmio/alice 包加载 yaml 文件。
在包含多对多关系的第二个实体时会出现奇怪的行为。运行加载命令时会引发警告:
[Symfony\Component\Debug\Exception\ContextErrorException] 警告: 复制(http://lorempixel.com/640/480/?35984):无法打开流: 无法建立连接..
yaml文件代码如下:
AppBundle\Entity\ComponentInstance:
componentInstance_{1..30}:
componentCode: <componentInstanceCode()>
componentId: <numberBetween(1,50)>
sectionInstance: '@sectionInstance_*'
date: <datetime()>
images: '@componentImage_{1..2}'
AppBundle\Entity\ComponentImage:
componentImage_{1..4}:
imageName: <name()>
imagePath: <image()>
imageAlt: <text()>
width: <numberBetween(100,500)>
height: <numberBetween(100,500)>
components: '@componentInstance_{1..2}'
当我将 cmets 放在 ComponentImage 部分时,它可以正常工作。 整个项目中没有该 url 的踪迹。
image() 函数如下:
public function images()
{
$genera = [
'/images/color_pencils.jpg',
'/images/half_color_pencils.jpg',
'/images/rainbow_wood.bmp',
'/images/color_smoke.jpg'
];
$key = array_rand($genera);
return $genera[$key];
}
有什么建议吗?
【问题讨论】:
-
可能是 ComponentImage 上的一些实体监听器?
-
可以this 帮忙吗?
-
谢谢你的 cmets @Matteo 问题是另一个,更愚蠢的方式。我会写一个答案
标签: doctrine-orm fixtures nelmio-alice