示例#1
0
 /**
  * Find similar injections
  *
  * @param InjectionVial $injection
  */
 public function findSimilar(InjectionVial $injection)
 {
     $filter = new VialFilter();
     $filter->setAccess('shared');
     $filter->setFilter('all');
     $startDate = clone $injection->getSetupDate();
     $stopDate = clone $injection->getSetupDate();
     $startDate->sub(new \DateInterval('P2W'));
     $stopDate->add(new \DateInterval('P2W'));
     $owner = $this->getObjectManager()->getOwner($injection);
     $qb = $this->getListQueryBuilder($filter);
     $qb->andWhere('e.injectionType = :injection_type')->andWhere('e.constructName = :construct_name')->andWhere('e.targetStock = :target_stock')->andWhere('e.setupDate > :start_date')->andWhere('e.setupDate <= :stop_date')->orderBy('e.setupDate', 'ASC')->addOrderBy('e.id', 'ASC')->setParameter('injection_type', $injection->getInjectionType())->setParameter('construct_name', $injection->getConstructName())->setParameter('target_stock', $injection->getTargetStock())->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();
 }
示例#2
0
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $vm)
 {
     $vm = $this->container->get('vib.doctrine.registry')->getManagerForClass('VIB\\FliesBundle\\Entity\\InjectionVial');
     $vm->disableAutoAcl();
     $user = $this->getReference('user');
     $vial_1 = new InjectionVial();
     $vial_1->setTargetStock($this->getReference('stock_4'));
     $vial_1->setConstructName('test');
     $vial_1->setEmbryoCount(100);
     $vm->persist($vial_1);
     $vm->flush();
     $vm->createACL($vial_1, $user);
     $vial_2 = new InjectionVial();
     $vial_2->setTargetStockVial($this->getReference('vial_1'));
     $vial_2->setConstructName('test');
     $vial_2->setEmbryoCount(100);
     $vm->persist($vial_2);
     $vm->flush();
     $vm->createACL($vial_2, $user);
     $vm->enableAutoAcl();
 }
示例#3
0
 public function crossParentNameProvider()
 {
     $stock = new Stock();
     $stock->setGenotype('test genotype');
     $stock->setName('test stock');
     $stockVial = new StockVial();
     $stockVial->setStock($stock);
     $injection = new InjectionVial();
     $injection->setTargetStock($stock);
     $injection->setConstructName('test');
     return array(array(new FakeCrossVial(), null, 'test'), array(new FakeCrossVial(), $stockVial, 'test parent'), array(new FakeCrossVial(), $injection, 'test parent'), array(new FakeCrossVial(), new CrossVial(), 'test'));
 }
示例#4
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->targetStockVial = new StockVial();
     $this->targetStockVial->setStock(new Stock());
     $this->targetStockVial->getStock()->setName('test stock');
     $this->targetStockVial->getStock()->setGenotype('test / test');
     $this->embryoCount = 100;
     $this->constructName = 'construct';
 }