getOwner() public method

public getOwner ( ) : Owner
return Owner
Ejemplo n.º 1
0
 /**
  * Populates document with bundle data.
  *
  * @param \Solarium_Document_ReadWrite $document
  * @param Bundle                       $bundle
  * @param \Solarium_Query_Helper       $helper
  */
 private function updateDocumentFromBundle(\Solarium_Document_ReadWrite $document, Bundle $bundle, \Solarium_Query_Helper $helper)
 {
     $document->setField('id', $bundle->getId());
     $document->setField('name', $bundle->getName());
     $document->setField('ownerName', $bundle->getOwnerName());
     $document->setField('ownerType', $bundle->getOwnerType());
     $document->setField('fullName', $bundle->getFullName());
     $document->setField('description', $bundle->getDescription());
     $document->setField('readme', $bundle->getReadme());
     $document->setField('totalScore', $bundle->getScore());
     $document->setField('state', $bundle->getState());
     $document->setField('avatarUrl', $bundle->getOwner()->getAvatarUrl());
     $document->setField('lastCommitAt', $helper->formatDate(clone $bundle->getLastCommitAt()));
     $document->setField('lastTweetedAt', null !== $bundle->getLastTweetedAt() ? $helper->formatDate($bundle->getLastTweetedAt()) : null);
     $keywords = array();
     foreach ($bundle->getKeywords() as $keyword) {
         $keywords[mb_strtolower($keyword->getValue(), 'UTF-8')] = true;
     }
     $document->setField('keywords', array_keys($keywords));
 }
Ejemplo n.º 2
0
 /**
  * Removes a specified bundle
  *
  * @param Bundle $bundle
  */
 protected function removeBundle(Bundle $bundle)
 {
     $owner = $bundle->getOwner();
     if ($owner instanceof Owner) {
         $owner->removeBundle($bundle);
     }
     // remove bundle from search index
     $this->indexer->deleteBundlesIndexes($bundle);
     $this->em->remove($bundle);
     $this->em->flush();
     // @todo also delete folder
     if ($this->logger) {
         $this->logger->warn(sprintf('Bundle "%s" was deleted', $bundle->getName()));
     }
 }