예제 #1
0
$ngi1->addScope($scopes[0]);
// ngi2 has 2 scopes
$ngi2->addScope($scopes[0]);
$ngi2->addScope($scopes[1]);
// ngi3 has 3 scopes
$ngi3->addScope($scopes[0]);
$ngi3->addScope($scopes[1]);
$ngi3->addScope($scopes[2]);
//  ngi4 has all scopes
for ($i = 0; $i < $scopeCount; $i++) {
    $ngi4->addScope($scopes[$i]);
}
// NGIs ****************************
// At least one certStatus is needed for the tests
$certStatus = new CertificationStatus();
$certStatus->setName('Certified');
$this->em->persist($certStatus);
// Sites: all have same 'Certified' cert status
// ****************************
$site0 = TestUtil::createSampleSite("Site0");
$site0->setCertificationStatus($certStatus);
$site1 = TestUtil::createSampleSite("Site1");
$site1->setCertificationStatus($certStatus);
$site2 = TestUtil::createSampleSite("Site2");
$site2->setCertificationStatus($certStatus);
$site3 = TestUtil::createSampleSite("Site3");
$site3->setCertificationStatus($certStatus);
$site4 = TestUtil::createSampleSite("Site4");
$site4->setCertificationStatus($certStatus);
$this->em->persist($site0);
$this->em->persist($site1);
예제 #2
0
<?php

require_once __DIR__ . "/../bootstrap.php";
require_once __DIR__ . "/AddUtils.php";
/* AddNGIs.php: Loads a list of cert statuses from an XML file and inserts them into
 * the doctrine prototype.
 * XML format is the xml input format of the cert status seed data
 */
$certStatsFileName = __DIR__ . "/" . $GLOBALS['dataDir'] . "/CertificationStatuses.xml";
$certStats = simplexml_load_file($certStatsFileName);
foreach ($certStats as $certStat) {
    $doctrineCertStat = new CertificationStatus();
    $name = "";
    foreach ($certStat as $key => $value) {
        if ($key == "name") {
            $name = (string) $value;
        }
    }
    $doctrineCertStat->setName($name);
    $entityManager->persist($doctrineCertStat);
}
$entityManager->flush();