public function checkIfExists(InstitutionProperty $institutionProperty, InstitutionMedicalCenter $center) { $this->doctrine = $this->getContainer()->get('doctrine'); $qb = $this->doctrine->getEntityManager()->createQueryBuilder()->select('a')->from('InstitutionBundle:InstitutionMedicalCenterProperty', 'a')->where('a.institution = :institution')->andWhere('a.institutionMedicalCenter = :imc')->andWhere('a.institutionPropertyType = :insProperty')->andWhere('a.value = :value')->setParameter('institution', $institutionProperty->getInstitution()->getId())->setParameter('imc', $center->getId())->setParameter('insProperty', $institutionProperty->getInstitutionPropertyType()->getId())->setParameter('value', $institutionProperty->getValue())->getQuery(); if (count($qb->getResult()) >= 1) { return true; } return false; }
public function createInstitutionPropertyByServices(InstitutionProperty $institutionProperty) { $institution = $institutionProperty->getInstitution(); $ipType = $institutionProperty->getInstitutionPropertyType(); $ipArray = $institutionProperty->getValue(); if (\is_array($ipArray)) { foreach ($ipArray as $key => $value) { $institutionProperty = new InstitutionProperty(); $institutionProperty->setInstitution($institution); $institutionProperty->setInstitutionPropertyType($ipType); $institutionProperty->setValue($value); $this->save($institutionProperty); } } else { $this->save($institutionProperty); } }
/** * @depends testCreateInstitutionPropertyByName */ public function testSaveInstitutionProperty(InstitutionProperty $property) { $property->setValue("test value"); $this->service->save($property); $this->assertGreaterThan(0, $property->getId()); }
public function __construct(InstitutionProperty $institutionProperty) { $this->parent = $institutionProperty->getInstitutionPropertyType()->getDataType()->getFormField(); $this->institutionProperty = $institutionProperty; }