setFilterString example


    protected function saveBackup($path$filterString$operations$items)
    {
        $backup = new BackupModel();

        $backup->setFilterString($filterString);
        $backup->setOperationString($this->operationsToString($operations));
        $backup->setItems($items);
        $backup->setPath($path);
        $backup->setHash(sha1_file($path));
        $backup->setSize((int) filesize($path));

        $backup->setDate(new DateTime());

        $this->getDqlHelper()->getEntityManager()->persist($backup);
        $this->getDqlHelper()->getEntityManager()->flush($backup);
    }

    
if (!empty($queueId)) {
            $newBackup = false;
            /** @var QueueModel|null $queue */
            $queue = $entityManager->find(QueueModel::class$queueId);
            if (!$queue) {
                throw new RuntimeException(sprintf('Queue with ID %s not found', $queueId));
            }
        } else {
            $newBackup = true;
            $queue = new QueueModel('product');
            $queue->setFilterString($filterString);
            $queue->setOperations(json_encode($operations));
            $queue->setCreated(new DateTime());
            $queue->setActive(false);
            $queue->setInitialSize($totalCount);

            $entityManager->persist($queue);
            $entityManager->flush();

            $queueId = $queue->getId();
        }

        
Home | Imprint | This part of the site doesn't use cookies.