Exemplo n.º 1
0
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $vm)
 {
     $vm = $this->container->get('vib.doctrine.registry')->getManagerForClass('VIB\\FliesBundle\\Entity\\CrossVial');
     $vm->disableAutoAcl();
     $user = $this->getReference('user');
     $vial = new CrossVial();
     $vial->setVirgin($this->getReference('stock_1')->getVials()->first());
     $vial->setMale($this->getReference('stock_2')->getVials()->first());
     $vm->persist($vial);
     $vm->flush();
     $vm->createACL($vial, $user);
     $vm->enableAutoAcl();
 }
Exemplo n.º 2
0
 /**
  * Find similar crosses
  *
  * @param CrossVial $cross
  */
 public function findSimilar(CrossVial $cross)
 {
     $filter = new VialFilter();
     $filter->setAccess('shared');
     $filter->setFilter('all');
     $startDate = clone $cross->getSetupDate();
     $stopDate = clone $cross->getSetupDate();
     $startDate->sub(new \DateInterval('P2W'));
     $stopDate->add(new \DateInterval('P2W'));
     $owner = $this->getObjectManager()->getOwner($cross);
     $qb = $this->getListQueryBuilder($filter);
     $qb->andWhere('e.maleName = :male_name')->andWhere('e.virginName = :virgin_name')->andWhere('e.setupDate > :start_date')->andWhere('e.setupDate <= :stop_date')->orderBy('e.setupDate', 'ASC')->addOrderBy('e.id', 'ASC')->setParameter('male_name', $cross->getUnformattedMaleName())->setParameter('virgin_name', $cross->getUnformattedVirginName())->setParameter('start_date', $startDate->format('Y-m-d'))->setParameter('stop_date', $stopDate->format('Y-m-d'));
     return $this->getAclFilter()->apply($qb, $filter->getPermissions(), $owner)->getResult();
 }
Exemplo n.º 3
0
 public function __construct(Vial $template = null, $flip = true)
 {
     parent::__construct($template, $flip);
     $this->id = 1;
     $this->setupDate = new \DateTime('2000-01-01 00:00:00');
     $this->male = new StockVial();
     $this->male->setStock(new Stock());
     $this->maleName = 'test male';
     $this->virgin = new StockVial();
     $this->virgin->setStock(new Stock());
     $this->virginName = 'test virgin';
 }