setCreatedAt() public method

Set the bundle creation date
public setCreatedAt ( DateTime $createdAt )
$createdAt DateTime
Example #1
0
 /**
  * Return true if the Repo exists on GitHub, false otherwise
  *
  * @param Entity\Bundle $bundle
  * @param array $data
  * @return boolean whether the Repo exists on GitHub
  */
 public function updateInfos(Entity\Bundle $bundle)
 {
     $this->output->write(' infos');
     try {
         $data = $this->github->getRepoApi()->show($bundle->getUsername(), $bundle->getName());
     } catch (\Github_HttpClient_Exception $e) {
         if (404 == $e->getCode()) {
             return false;
         }
         throw $e;
     }
     if ($data['fork']) {
         if ($data['watchers'] >= 10) {
             // Let's try to keep a forked repo with lots of watchers
         } else {
             return false;
         }
     }
     $bundle->setDescription(empty($data['description']) ? null : $data['description']);
     $bundle->setNbFollowers($data['watchers']);
     $bundle->setNbForks($data['forks']);
     $bundle->setCreatedAt(new \DateTime($data['created_at']));
     $bundle->setHomepage(empty($data['homepage']) ? null : $data['homepage']);
     return $bundle;
 }
Example #2
0
 /**
  * @Given /^the site has following bundles:$/
  */
 public function theSiteHasFollowingBundles(TableNode $table)
 {
     $entityManager = $this->getEntityManager();
     $this->bundles = array();
     foreach ($table->getHash() as $row) {
         if (isset($this->developers[$row['username']])) {
             $owner = $this->developers[$row['username']];
         } elseif (isset($this->organizations[$row['username']])) {
             $owner = $this->organizations[$row['username']];
         } else {
             continue;
         }
         $bundle = new Entity\Bundle();
         $bundle->fromArray(array('name' => $row['name'], 'owner' => $owner, 'ownerName' => $owner->getName(), 'description' => $row['description'], 'readme' => isset($row['readme']) ? $row['readme'] : '', 'state' => isset($row['state']) ? $row['state'] : Entity\Bundle::STATE_UNKNOWN));
         if (isset($row['license'])) {
             $bundle->setLicenseType($row['license']);
         }
         if (isset($row['createdAt'])) {
             $bundle->setCreatedAt(new \DateTime($row['createdAt']));
         }
         if (isset($row['lastCommitAt'])) {
             $bundle->setLastCommitAt(new \DateTime($row['lastCommitAt']));
         }
         $bundle->setScore($row['score']);
         $versionsHistory['dependencies']['dev-master'] = array('name' => 'friendsofsymfony/user-bundle', 'extra' => array('branch-alias' => array('dev-master' => '2.0.x-dev')), 'require' => array('php' => '>=5.3.2'), 'require-dev' => '', 'suggest' => '');
         $bundle->setVersionsHistory($versionsHistory);
         $this->setPrivateProperty($bundle, "trend1", $row['trend1']);
         if (isset($row['recommendedBy'])) {
             $ownerNames = explode(',', $row['recommendedBy']);
             foreach ($ownerNames as $ownerName) {
                 $owner = $this->developers[trim($ownerName)];
                 $bundle->addRecommender($owner);
                 $owner->addRecommendedBundle($bundle);
                 $entityManager->persist($owner);
             }
         }
         $entityManager->persist($bundle);
         $this->bundles[$bundle->getName()] = $bundle;
     }
     $entityManager->flush();
 }
Example #3
0
 /**
  * Return true if the Repo exists on GitHub, false otherwise
  *
  * @param Bundle $bundle
  *
  * @return boolean whether the Repo exists on GitHub
  */
 public function updateInfos(Bundle $bundle)
 {
     $this->output->write(' infos');
     try {
         $data = $this->github->api('repo')->show($bundle->getOwnerName(), $bundle->getName());
     } catch (RuntimeException $e) {
         return false;
     }
     // Let's try to only keep a forked repo with lots of watchers
     if ($data['fork'] && $data['watchers'] < 10) {
         return false;
     }
     $bundle->setDescription(empty($data['description']) ? null : $data['description']);
     $bundle->setNbFollowers($data['watchers']);
     $bundle->setNbForks($data['forks']);
     $bundle->setIsFork($data['fork']);
     $bundle->setCreatedAt(new \DateTime($data['created_at']));
     $bundle->setHomepage(empty($data['homepage']) ? null : $data['homepage']);
     return true;
 }