Knp\Bundle\KnpBundlesBundle\Entity\Bundle::setOwnerName PHP Method

setOwnerName() public method

Set ownerName
public setOwnerName ( string $ownerName )
$ownerName string
    public function setOwnerName($ownerName)
    {
        $this->ownerName = $ownerName;
    }

Usage Example

コード例 #1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     /** @var SolrIndexer $indexer */
     $indexer = $this->getContainer()->get('knp_bundles.indexer.solr');
     /** @var EntityManager $em */
     $em = $this->getContainer()->get('doctrine')->getManager();
     /** @var \Solarium_Client $solarium */
     $solarium = $this->getContainer()->get('solarium.client');
     /** @var EntityRepository $repository */
     $repository = $em->getRepository('KnpBundlesBundle:Bundle');
     $query = $solarium->createSelect();
     $query->setFields(array('name', 'ownerName'));
     try {
         $hasMoreResults = true;
         $page = 1;
         while ($hasMoreResults) {
             $paginator = new Pagerfanta(new SolariumAdapter($solarium, $query));
             $paginator->setMaxPerPage(50)->setCurrentPage($page, false, true);
             foreach ($paginator as $bundle) {
                 $entity = $repository->findOneBy(array('name' => $bundle['name']));
                 if (!$entity) {
                     $entity = new Bundle();
                     $entity->setName($bundle['name']);
                     $entity->setOwnerName($bundle['ownerName']);
                     $indexer->deleteBundlesIndexes($entity);
                     $output->writeln(sprintf('The bundle "%s" was deleted from solr index.', $entity->getFullName()));
                 }
             }
             $hasMoreResults = $paginator->getNbResults() == 50;
             $page++;
         }
     } catch (\Solarium_Client_HttpException $e) {
         throw new \Exception('Seems that our search engine is currently offline. Please check later.');
     }
 }
All Usage Examples Of Knp\Bundle\KnpBundlesBundle\Entity\Bundle::setOwnerName