partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

StorageLocationLoader.php (983B)


      1 <?php
      2 
      3 namespace PartKeepr\StorageLocationBundle\DataFixtures;
      4 
      5 use Doctrine\Common\DataFixtures\AbstractFixture;
      6 use Doctrine\Common\Persistence\ObjectManager;
      7 use PartKeepr\StorageLocationBundle\Entity\StorageLocation;
      8 
      9 class StorageLocationLoader extends AbstractFixture
     10 {
     11     public function load(ObjectManager $manager)
     12     {
     13         $storageLocation = new StorageLocation();
     14         $storageLocation->setName('test');
     15         $storageLocation->setCategory($this->getReference('storagelocationcategory.first'));
     16 
     17         $storageLocation2 = new StorageLocation();
     18         $storageLocation2->setName('test2');
     19         $storageLocation2->setCategory($this->getReference('storagelocationcategory.second'));
     20 
     21         $manager->persist($storageLocation);
     22         $manager->persist($storageLocation2);
     23         $manager->flush();
     24 
     25         $this->addReference('storagelocation.first', $storageLocation);
     26         $this->addReference('storagelocation.second', $storageLocation2);
     27     }
     28 }