setBundleOwnerName() public method

public setBundleOwnerName ( string $bundleOwnerName )
$bundleOwnerName string
示例#1
0
 protected function makeBundle($manager, Entity\Owner $owner, $i, $contributor = null)
 {
     $trilean = array(true, false, null);
     $bundle = new Entity\Bundle();
     $bundle->fromArray(array('name' => ucfirst($owner->getName()) . $i . 'FooBundle', 'description' => $this->descriptions[mt_rand(0, 4)], 'homepage' => $i % 2 ? 'Bundle' . $i . '.com' : null, 'readme' => str_replace('__BUNDLE__', "the bundle number: {$i}", $this->readme), 'usesTravisCi' => $i % 2 ? false : true, 'composerName' => $i % 2 ? null : 'knplabs/knp-menu-bundle', 'versionsHistory' => array('symfony' => array('dev-master' => '2.1.*', '1.2.0' => '2.0.*', '1.1.0' => '2.*'), 'dependencies' => array('dev-master' => array('name' => 'friendsofsymfony/user-bundle', 'extra' => array('branch-alias' => array('dev-master' => '2.0.x-dev')), 'require' => array('php' => '>=5.3.2', 'symfony/framework-bundle' => '>=2.1,<2.3-dev', 'symfony/security-bundle' => '>=2.1,<2.3-dev'), 'require-dev' => array('twig/twig' => '*', 'doctrine/doctrine-bundle' => '*', 'swiftmailer/swiftmailer' => '*', 'willdurand/propel-typehintable-behavior' => 'dev-master', 'symfony/validator' => '2.1.*', 'symfony/yaml' => '2.1.*'), 'suggest' => array('doctrine/couchdb-odm-bundle' => '*', 'doctrine/doctrine-bundle' => '*', 'doctrine/mongodb-odm-bundle' => '*')), '1.2.x-dev' => array('name' => 'friendsofsymfony/user-bundle', 'require' => array('php' => '>=5.3.2', 'symfony/framework-bundle' => '>=2.1,<2.3-dev', 'symfony/security-bundle' => '>=2.1,<2.3-dev'), 'require-dev' => '', 'suggest' => ''))), 'state' => $this->states[mt_rand(0, 3)], 'license' => $i % 4 == 0 ? 'Some pseudo license data' : null, 'licenseType' => $i % 3 == 0 ? $this->licenses[mt_rand(0, 2)] : null, 'travisCiBuildStatus' => $i % 2 == 0 ? $trilean[$i % 3] : null, 'nbFollowers' => $i * 10, 'nbForks' => $i, 'isFork' => false, 'contributors' => $contributor ? array($contributor) : array(), 'canonicalConfig' => $i % 2 == 0 ? $this->canonicalConfigDump : null, 'nbRecommenders' => rand(0, 90)));
     $commits = array(array('date' => '2010-05-16T09:58:32-09:00', 'author' => $owner instanceof Entity\Developer ? $owner->getName() : 'Random Person', 'message' => 'Fix something on this Bundle'), array('date' => '2010-05-16T09:58:32-07:00', 'author' => 'Fake Name', 'message' => 'Commit something on this bundle'));
     foreach ($commits as $commit) {
         $lastCommitAt = new \DateTime();
         $lastCommitAt->setTimestamp(strtotime($commit['date']));
         $bundle->setLastCommitAt($lastCommitAt);
         $activity = new Entity\Activity();
         $activity->setType(Entity\Activity::ACTIVITY_TYPE_COMMIT);
         $activity->setMessage(strtok($commit['message'], "\n\r"));
         $activity->setCreatedAt($lastCommitAt);
         $activity->setBundle($bundle);
         if ($owner->getName() == $commit['author']) {
             $owner->setLastCommitAt($lastCommitAt);
             $activity->setDeveloper($owner);
             $activity->setBundleOwnerName(strtolower($owner->getName()));
         } else {
             $activity->setAuthor($commit['author']);
             $activity->setBundleOwnerName(strtolower($commit['author']));
         }
         $manager->persist($activity);
     }
     $owner->addBundle($bundle);
     return $bundle;
 }