Skip to content

Commit

Permalink
Doctypes in fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
Stoakes committed Jan 22, 2017
1 parent 5877eca commit 1694057
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 0 deletions.
File renamed without changes.
60 changes: 60 additions & 0 deletions src/Mgate/PubliBundle/DataFixtures/ORM/LoadDocTypeData.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php

namespace Mgate\PubliBundle\DataFixtures\ORM;

use Doctrine\Common\DataFixtures\FixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Mgate\PubliBundle\Entity\Document;
use Mgate\StatBundle\Entity\Indicateur;

/**
* Class LoadDocTypeData
* @package Mgate\PubliBundle\DataFixtures\ORM
* Creates default doctypes.
*/
class LoadDocTypeData implements FixtureInterface
{
/**
* {@inheritdoc}
*/
public function load(ObjectManager $manager)
{
//avant-projet
$ap = new Document();
$ap->setName('AP');
$ap->setPath('AP.docx');
$ap->setSize(98000);
$manager->persist($ap);

//convention client
$cc = new Document();
$cc->setName('CC');
$cc->setPath('CC.docx');
$cc->setSize(31000);
$manager->persist($cc);

//bulletin adhésion
$ba = new Document();
$ba->setName('BA');
$ba->setPath('BA.docx');
$ba->setSize(20000);
$manager->persist($ba);

//proces verbal de reception final
$pvr = new Document();
$pvr->setName('PVR');
$pvr->setPath('PVR.docx');
$pvr->setSize(17000);
$manager->persist($pvr);

//recapitulatif de mission
$rm = new Document();
$rm->setName('RM');
$rm->setPath('RM.docx');
$rm->setSize(26000);
$manager->persist($rm);


$manager->flush();
}
}
11 changes: 11 additions & 0 deletions src/Mgate/PubliBundle/Entity/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,16 @@ public function getSize()
return $this->size;
}

/**
* @param mixed $size
* @return Document
*/
public function setSize($size)
{
$this->size = $size;
return $this;
}

/**
* @return \DateTime
*/
Expand Down Expand Up @@ -310,4 +320,5 @@ public function setRootDir($rootDir)
}



}
Empty file added var/documents/.gitkeep
Empty file.
Binary file added var/documents/AP.docx
Binary file not shown.
Binary file added var/documents/BA.docx
Binary file not shown.
Binary file added var/documents/CC.docx
Binary file not shown.
Binary file added var/documents/PVRF.docx
Binary file not shown.
Binary file added var/documents/RM.docx
Binary file not shown.

0 comments on commit 1694057

Please sign in to comment.