Author: Gawain Lynch (gawain.lynch@gmail.com)
 public function getMissingRecords()
 {
     $missing = [];
     foreach ($this->records as $record) {
         $repo = $this->storage->getRepository($record->getContentType());
         $fields = $this->getRequiredFieldsArrayFromRecord($record);
         if (count($fields)) {
             $results = $repo->findBy($fields);
             if (!$results) {
                 $missing[] = $record;
             }
         }
     }
     return $missing;
 }
Exemplo n.º 2
0
 /**
  * Handle any pending timed publish/hold transitions.
  *
  * @param string $contentTypeName
  * @param string $type
  */
 private function timedHandleRecords($contentTypeName, $type)
 {
     /** @var ContentRepository $contentRepo */
     try {
         $contentRepo = $this->em->getRepository($contentTypeName);
     } catch (InvalidRepositoryException $e) {
         // ContentType doesn't have a repository
         return;
     }
     $types = ['timed' => ['target' => 'published', 'legacy' => 'publish'], 'hold' => ['target' => 'held', 'legacy' => 'depublish']];
     try {
         $records = $this->getTimedRecords($contentRepo, $type);
     } catch (TableNotFoundException $e) {
         return;
     }
     /** @var Content $content */
     foreach ($records as $content) {
         $content->set('status', $types[$type]['target']);
         $this->save($contentRepo, $content, $type, $types[$type]['legacy']);
     }
 }
Exemplo n.º 3
0
 /**
  * Delete any save authtokens for a user.
  *
  * @param Entity\Users $user
  */
 private function deleteAuthtokens(Entity\Users $user)
 {
     /** @var \Bolt\Storage\Repository\AuthtokenRepository $repo */
     $repo = $this->em->getRepository('Bolt\\Storage\\Entity\\Authtoken');
     $repo->deleteTokens($user->getUsername());
 }
Exemplo n.º 4
0
 /**
  * @return Repository\AuthtokenRepository
  */
 protected function getRepositoryAuthtoken()
 {
     return $this->em->getRepository(Entity\Authtoken::class);
 }