Skip to content

Instantly share code, notes, and snippets.

@simshaun
Created September 1, 2016 23:16
Show Gist options
  • Save simshaun/906cf9949b6ee821ceb0845307b14a20 to your computer and use it in GitHub Desktop.
Save simshaun/906cf9949b6ee821ceb0845307b14a20 to your computer and use it in GitHub Desktop.
Alice Doctrine ArrayCollection data provider
<?php
namespace AppBundle\DataFixtures\Faker;
use Doctrine\Common\Collections\ArrayCollection;
class ArrayCollectionProvider
{
public function ArrayCollection($elements)
{
return new ArrayCollection($elements);
}
}
services:
alice.provider.array_collection:
class: AppBundle\DataFixtures\Faker\ArrayCollectionProvider
tags:
- { name: hautelook_alice.faker.provider }
Entity\AdSpot:
adspot_foo:
name: 'Foo'
adspot_bar:
name: 'Bar'
Entity\Ad:
ad_1:
name: 'FPO 1'
spots: <ArrayCollection([@adspot_foo, @adspot_bar])>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment