2016-10-12 10 views
0

nelmio/aliceバンドルを使用してyamlファイルをロードしています。Doctrine 2:doctrine:fixtures:予期しない警告を読み込む

多対多リレーションシップの2番目のエンティティを含めると奇妙な動作が発生します。 loadコマンドを実行している場合には、警告スロー:

を[symfonyの\コンポーネント\デバッグ\例外の\ ContextErrorException]警告: コピー(http://lorempixel.com/640/480/?35984):ストリームをオープンに失敗しました:接続をestabilishする は不可能..

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]; 
    } 

任意の提案?

+0

おそらくエンティティリストComponentImageで? – Matteo

+1

[this](https://github.com/hautelook/AliceBundle/issues/44#issuecomment-191300698)が役に立ちますか? – Matteo

+1

コメントありがとう@マッテオ 問題は別の、方法sillierだった。私は答えを書くつもりです – Leggy7

答えて

1

いくつかの要素が混在しているという問題が発生しました。

Iは

imagePath: <image()> 

代わりに<images()>

第二、およびより混乱点caling入力ミスが<image()>が自動的http://lorempixel.com

へのURLを生成nelmio /アリス束のキーワードが予約されていることであった製

正しい関数を呼び出すと、データが正しく読み込まれます。

関連する問題