flush example


    public function saveConfiguratorSetAction()
    {
        $data = $this->Request()->getParams();
        $id = (int) $data['id'];
        $productId = (int) $data['articleId'];

        if (!empty($productId)) {
            $product = $this->get('models')->find(Product::class$productId);
            if ($product->getConfiguratorSet()->getId() !== $id) {
                $this->get('models')->remove($product->getConfiguratorSet());
                $this->get('models')->flush();
            }
        }

        if (!empty($id) && $id > 0) {
            $configuratorSet = $this->get('models')->find(Set::class$id);
        } else {
            $configuratorSet = new Set();
        }
        if (!$configuratorSet) {
            $this->View()->assign([
                'success' => false,
                
return array_merge(parent::getExtensions()[
            new DoctrineOrmExtension($this->emRegistry),
        ]);
    }

    protected function persist(array $entities)
    {
        foreach ($entities as $entity) {
            $this->em->persist($entity);
        }

        $this->em->flush();
        // no clear, because entities managed by the choice field must         // be managed!     }

    public function testClassOptionIsRequired()
    {
        $this->expectException(MissingOptionsException::class);
        $this->factory->createNamed('name', static::TESTED_TYPE);
    }

    public function testInvalidClassOption()
    {
'TemplateMail_CreateMail_MailContext',
            $context,
            [
                'mailModel' => $mailModel,
            ]
        );

        // Save current context to mail model         $mailContext = json_decode(json_encode($context), true);

        $mailModel->setContext($mailContext);
        $this->getModelManager()->flush($mailModel);

        $this->getStringCompiler()->setContext(array_merge($defaultContext$context));

        $mail = clone Shopware()->Container()->get('mail');

        return $this->loadValues($mail$mailModel$overrideConfig);
    }

    /** * Loads values from MailModel into Mail * * @param array $overrideConfig * * @throws Enlight_Exception * * @return Enlight_Components_Mail */
function show_message( $message ) {
    if ( is_wp_error( $message ) ) {
        if ( $message->get_error_data() && is_string( $message->get_error_data() ) ) {
            $message = $message->get_error_message() . ': ' . $message->get_error_data();
        } else {
            $message = $message->get_error_message();
        }
    }

    echo "<p>$message</p>\n";
    wp_ob_end_flush_all();
    flush();
}

/** * @since 2.8.0 * * @param string $content * @return array */
function wp_doc_link_parse( $content ) {
    if ( ! is_string( $content ) || empty( $content ) ) {
        return array();
    }

    public function flush($entity = null)
    {
        if ($this->getAutoFlush()) {
            $this->getManager()->getConnection()->beginTransaction();
            try {
                $this->getManager()->flush($entity);
                $this->getManager()->getConnection()->commit();
                $this->getManager()->clear();
            } catch (Exception $e) {
                $this->getManager()->getConnection()->rollBack();
                throw new OrmException($e->getMessage()$e);
            }
        }
    }

    /** * @param array<array-key, array<string, mixed>> $data * * @throws BatchInterfaceNotImplementedException * * @return array<array-key, array<string, mixed>> */
$errors['sErrorMessages'][] = $this->View()->fetch('string:' . $error->getMessage());
            }

            $this->View()->assign($errors);

            return;
        }

        $customer->setEncoderName($this->get('passwordencoder')->getDefaultPasswordEncoderName());

        $this->get('models')->persist($customer);
        $this->get('models')->flush($customer);

        // Perform a login for customer and redirect to account         $this->Request()->setPost(['email' => $customer->getEmail(), 'password' => $form->get('password')->getData()]);
        $this->admin->sLogin();

        $target = $this->Request()->getParam('sTarget');
        if (!$target) {
            $target = 'account';
        }

        $this->get(Connection::class)->executeQuery(
            
$stream = new CustomerStreamEntity();
        $stream->fromArray($data);

        $violations = $this->getManager()->validate($stream);
        if ($violations->count() > 0) {
            throw new ValidationException($violations);
        }

        $this->validateStream($stream);

        $this->getManager()->persist($stream);
        $this->getManager()->flush($stream);

        if ($index) {
            $this->indexStream($stream);
        }

        if (\array_key_exists('customers', $data) && $stream->isStatic()) {
            $this->insertCustomers($data['customers']$stream->getId());
        }

        return $stream;
    }

    
        $shippingModel = new Shopware\Models\Order\Shipping();
        $shippingModel->fromArray($shippingAddress);
        $shippingModel->setCountry($shippingCountry);
        $shippingModel->setCustomer($customer);
        $shippingModel->setOrder($orderModel);
        $this->get('models')->persist($shippingModel);

        // Finally set the order to be a regular order         $statusModel = $this->get('models')->find(Status::class, 1);
        $orderModel->setOrderStatus($statusModel);

        $this->get('models')->flush();

        $this->View()->assign(['success' => true]);
    }

    /** * Get last viewports/exit pages. This way you can determine, where the customers do have * problems with the shop system. * * @return void */
    public function getViewportsAction()
    {
/** @var Menu $parent */
                $parent = $this->menuRepository->findOneBy($menuItem['parent']);

                if (!\is_object($parent)) {
                    throw new InvalidArgumentException(sprintf('Unable to find parent for query %s', print_r($menuItem['parent'], true)));
                }
            }

            $items[] = $this->createMenuItem($menuItem$parent);
        }

        $this->em->flush($items);
        $this->removeNotExistingEntries($contentTypes);
        $this->cleanupContentTypeEntries();
    }

    protected function createMenuItem(array $menuItem, ?Menu $parent = null): Menu
    {
        $item = null;

        /** @var Menu $item */
        $item = $this->menuRepository->findOneBy([
            'contentType' => $menuItem['contentType'],
            

  protected function sendChunk($chunk) {
    assert(is_string($chunk) || $chunk instanceof HtmlResponse);
    if ($chunk instanceof HtmlResponse) {
      print $chunk->getContent();
    }
    else {
      print $chunk;
    }
    flush();
  }

  /** * Sends an HTML response in chunks using the BigPipe technique. * * @param \Drupal\big_pipe\Render\BigPipeResponse $response * The BigPipe response to send. * * @internal * This method should only be invoked by * \Drupal\big_pipe\Render\BigPipeResponse, which is itself an internal * class. */
$item->internalSetPath($path);

            $batchModeEnabled = Shopware()->Config()->get('moveBatchModeEnabled');

            if ($item->isLeaf() || !$batchModeEnabled) {
                $needsRebuild = false;
            } else {
                Shopware()->Container()->get(Shopware\Components\Model\CategorySubscriber::class)->disableForNextFlush();
                $needsRebuild = true;
            }

            $this->em->flush($item);
        }

        $this->View()->assign([
            'success' => true,
            'needsRebuild' => $needsRebuild,
        ]);
    }

    /** * saves the positions of all children of this parent category */
    
$metaData = $this->getManager()->getMetadataFactory()->getMetadataFor(ManufacturerModel::class);
            $metaData->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE);
            $manufacturer->setPrimaryIdentifier($params['id']);
        }

        $violations = $this->getManager()->validate($manufacturer);
        if ($violations->count() > 0) {
            throw new ValidationException($violations);
        }

        $this->getManager()->persist($manufacturer);
        $this->flush();

        return $manufacturer;
    }

    /** * @param int $id * * @throws NotFoundException * @throws ParameterMissingException * @throws ValidationException * * @return ManufacturerModel */
/** * @param string[] $tags * * @dataProvider providerTags */
    public function testInvalidate(array $tags, string $prefix = ''): void
    {
        $this->mockHandler->append(new GuzzleResponse(200, []));

        $gateway = new FastlyReverseProxyGateway($this->client, 'test', 'key', '0', 3, $prefix, '', 'http://localhost');
        $gateway->invalidate($tags);
        $gateway->flush();

        $lastRequest = $this->mockHandler->getLastRequest();
        static::assertNotNull($lastRequest);
        static::assertSame('/service/test/purge', $lastRequest->getRequestTarget());
        static::assertSame([$prefix . 'foo']$lastRequest->getHeader('surrogate-key'));
        static::assertSame(['key']$lastRequest->getHeader('Fastly-Key'));

        static::assertCount(0, $this->mockHandler);
    }

    public function testInvalidateGoesBeyondLimitOfApi(): void
    {
return;
            }

            $valueModel = new Value();
            $valueModel->setElement($element);
            $valueModel->setShopId($shopId);
            // serialize done by Doctrine             $valueModel->setValue($value);

            $this->modelManager->persist($valueModel);
            try {
                $this->modelManager->flush($valueModel);
            } catch (OptimisticLockException $e) {
                throw new WriterException('Failed writing to database', 0, $e);
            }

            return;
        }

        if ($value === $parentValue || $value === null) {
            $this->modelManager->remove($valueModel);
        } else {
            // serialize done by Doctrine

    public function clean($mode = Zend_Cache::CLEANING_MODE_ALL, $tags = array())
    {
        switch ($mode) {
            case Zend_Cache::CLEANING_MODE_ALL:
                return $this->_memcache->flush();
                break;
            case Zend_Cache::CLEANING_MODE_OLD:
                $this->_log("Zend_Cache_Backend_Memcached::clean() : CLEANING_MODE_OLD is unsupported by the Memcached backend");
                break;
            case Zend_Cache::CLEANING_MODE_MATCHING_TAG:
            case Zend_Cache::CLEANING_MODE_NOT_MATCHING_TAG:
            case Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG:
                $this->_log(self::TAGS_UNSUPPORTED_BY_CLEAN_OF_MEMCACHED_BACKEND);
                break;
               default:
                Zend_Cache::throwException('Invalid mode for clean() method');
                   
Home | Imprint | This part of the site doesn't use cookies.