isPrepared example

/** * {@inheritdoc} */
  public function getArguments(PlaceholderInterface $queryPlaceholder = NULL) {
    return $this->query->getArguments($queryPlaceholder);
  }

  /** * {@inheritdoc} */
  public function isPrepared() {
    return $this->query->isPrepared();
  }

  /** * {@inheritdoc} */
  public function preExecute(SelectInterface $query = NULL) {
    // If no query object is passed in, use $this.     if (!isset($query)) {
      $query = $this;
    }

    


        (new PaymentHandlerIdentifierSubscriber())->formatHandlerIdentifier($event);

        static::assertCount(1, $event->getEntities());

        /** @var PaymentMethodEntity $paymentMethod */
        $paymentMethod = $event->getEntities()[0];

        static::assertTrue($paymentMethod->isSynchronous());
        static::assertFalse($paymentMethod->isAsynchronous());
        static::assertFalse($paymentMethod->isPrepared());
    }

    public function testAsynchronousRuntimeField(): void
    {
        $event = $this->createMock(EntityLoadedEvent::class);
        $event
            ->method('getEntities')
            ->willReturn($this->getPaymentMethodEntity(
                $this->createMock(AsynchronousPaymentHandlerInterface::class)::class
            D);

        (
static::assertCount(5, $methods);

        static::assertSame('handler_shopware_synchronouspaymenthandlerinterface', $methods[0]->getFormattedHandlerIdentifier());
        static::assertSame('handler_shopware_asynchronouspaymenthandlerinterface', $methods[1]->getFormattedHandlerIdentifier());
        static::assertSame('handler_shopware_refundpaymenthandlerinterface', $methods[2]->getFormattedHandlerIdentifier());
        static::assertSame('handler_shopware_preparedpaymenthandlerinterface', $methods[3]->getFormattedHandlerIdentifier());
        static::assertSame('handler_shopware_recurringpaymenthandlerinterface', $methods[4]->getFormattedHandlerIdentifier());

        static::assertTrue($methods[0]->isSynchronous());
        static::assertFalse($methods[0]->isAsynchronous());
        static::assertFalse($methods[0]->isRefundable());
        static::assertFalse($methods[0]->isPrepared());
        static::assertFalse($methods[0]->isRecurring());

        static::assertFalse($methods[1]->isSynchronous());
        static::assertTrue($methods[1]->isAsynchronous());
        static::assertFalse($methods[1]->isRefundable());
        static::assertFalse($methods[1]->isPrepared());
        static::assertFalse($methods[1]->isRecurring());

        static::assertFalse($methods[2]->isSynchronous());
        static::assertFalse($methods[2]->isAsynchronous());
        static::assertTrue($methods[2]->isRefundable());
        


    public function formatHandlerIdentifier(EntityLoadedEvent $event): void
    {
        /** @var Entity $entity */
        foreach ($event->getEntities() as $entity) {
            $entity->assign([
                'shortName' => $this->getShortName($entity),
                'formattedHandlerIdentifier' => $this->getHandlerIdentifier($entity),
                'synchronous' => $this->isSynchronous($entity),
                'asynchronous' => $this->isAsynchronous($entity),
                'prepared' => $this->isPrepared($entity),
                'refundable' => $this->isRefundable($entity),
                'recurring' => $this->isRecurring($entity),
            ]);
        }
    }

    private function getHandlerIdentifier(Entity $entity): string
    {
        $explodedHandlerIdentifier = explode('\\', (string) $entity->get('handlerIdentifier'));

        if (\count($explodedHandlerIdentifier) < 2) {
            
/** * {@inheritdoc} */
  public function preExecute(SelectInterface $query = NULL) {
    // If no query object is passed in, use $this.     if (!isset($query)) {
      $query = $this;
    }

    // Only execute this once.     if ($query->isPrepared()) {
      return TRUE;
    }

    // Modules may alter all queries or only those having a particular tag.     if (isset($this->alterTags)) {
      // Many contrib modules as well as Entity Reference in core assume that       // query tags used for access-checking purposes follow the pattern       // $entity_type . '_access'. But this is not the case for taxonomy terms,       // since the core Taxonomy module used to add term_access instead of       // taxonomy_term_access to its queries. Provide backwards compatibility       // by adding both tags here instead of attempting to fix all contrib
Home | Imprint | This part of the site doesn't use cookies.