我正在使用 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}'
当我对 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];
}
有什么建议吗?