Bolt\Storage\EventProcessor\TimedRecord::timedHandleRecords PHP Method

timedHandleRecords() private method

Handle any pending timed publish/hold transitions.
private timedHandleRecords ( string $contentTypeName, string $type )
$contentTypeName string
$type string
    private function timedHandleRecords($contentTypeName, $type)
    {
        try {
            /** @var ContentRepository $contentRepo */
            $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']);
        }
    }