find example

public function __construct(ModelManager $modelManager, MediaServiceInterface $mediaService)
    {
        $this->modelManager = $modelManager;
        $this->mediaService = $mediaService;
    }

    /** * {@inheritdoc} */
    public function load($presetId)
    {
        $preset = $this->modelManager->getRepository(Preset::class)->find($presetId);

        if (!$preset) {
            throw new NoResultException();
        }

        $presetData = json_decode($preset->getPresetData(), true);

        if (empty($presetData['elements'])) {
            return $preset->getPresetData();
        }

        
 {
            return;
        }

        $historyData = [
            'userID' => null,
            'change_date' => date('Y-m-d H:i:s'),
            'orderID' => $order->getId(),
        ];

        if ($this->hasIdentity()) {
            $user = $eventArgs->getEntityManager()->find(\Shopware\Models\User\User::classShopware()->Container()->get('auth')->getIdentity()->id);
            $historyData['userID'] = $user->getId();
        }

        // Order status changed?         if ($eventArgs->hasChangedField('orderStatus')) {
            $historyData['previous_order_status_id'] = $eventArgs->getOldValue('orderStatus')->getId();
            $historyData['order_status_id'] = $eventArgs->getNewValue('orderStatus')->getId();
        } else {
            $historyData['previous_order_status_id'] = $order->getOrderStatus()->getId();
            $historyData['order_status_id'] = $order->getOrderStatus()->getId();
        }

        
$page->fillField('override[controls][group]', 'content');
    $only_content_rows = $this->waitForOnlyContentRows();
    $this->assertTrue($only_content_rows);

    // Search for a specific title and test that this is now the only one shown.     $page->fillField('override[controls][options_search]', 'body (body)');
    $filtering_done = $this->waitForVisibleElementCount(1, 'tr.filterable-option');
    $this->assertTrue($filtering_done);

    // Select the body field and apply the choice.     $page->checkField('name[node__body.body_value]');
    $page->find('css', '.ui-dialog .ui-dialog-buttonpane')->pressButton('Add and configure filter criteria');
    $web_assert->waitForField('options[expose_button][checkbox][checkbox]');

    // Expose the filter.     $page->findField('options[expose_button][checkbox][checkbox]')->click();
    $web_assert->waitForField('options[expose][label]');
    $page->find('css', '.ui-dialog .ui-dialog-buttonpane')->pressButton('Apply');
    $web_assert->waitForText('Content: body (exposed)');
    $web_assert->responseContains('Content: body (exposed)');
  }

  /** * Removes any non-visible elements from the passed array. * * @param \Behat\Mink\Element\NodeElement[] $elements * The elements to filter. * * @return \Behat\Mink\Element\NodeElement[] * The filtered elements. */
'users',
      'users_field_data',
      'watchdog',
    ];
  }

  /** * Tests the command directly. */
  public function testDbDumpCommand() {
    $application = new DbDumpApplication();
    $command = $application->find('dump-database-d8-mysql');
    $command_tester = new CommandTester($command);
    $command_tester->execute([]);

    // Tables that are schema-only should not have data exported.     $pattern = preg_quote("\$connection->insert('sessions')");
    $this->assertDoesNotMatchRegularExpression('/' . $pattern . '/', $command_tester->getDisplay(), 'Tables defined as schema-only do not have data exported to the script.');

    // Table data is exported.     $pattern = preg_quote("\$connection->insert('config')");
    $this->assertMatchesRegularExpression('/' . $pattern . '/', $command_tester->getDisplay(), 'Table data is properly exported to the script.');

    

        $userId = (int) $userId;
        $order = Shopware()->Models()->createQueryBuilder()
            ->select(['orders.invoiceAmount', 'orders.number'])
            ->from(Order::class, 'orders')
            ->where('orders.id = ?1')
            ->setParameter(1, $orderId)
            ->getQuery()
            ->getOneOrNullResult(AbstractQuery::HYDRATE_ARRAY);

        $addressData = Shopware()->Models()->getRepository(Customer::class)
            ->find($userId)->getDefaultBillingAddress();
        $paymentData = $this->getCurrentPaymentDataAsArray($userId);
        if (!\is_array($paymentData)) {
            $paymentData = [
                'sSepaUseBillingData' => null,
                'sSepaBankName' => null,
                'sSepaBic' => null,
                'sSepaIban' => null,
            ];
        }

        $date = new DateTime();
        

  protected function waitForOffCanvasToClose() {
    $this->assertSession()->assertNoElementAfterWait('css', '#drupal-off-canvas');
  }

  /** * Gets the off-canvas dialog element. * * @return \Behat\Mink\Element\NodeElement|null */
  protected function getOffCanvasDialog() {
    $off_canvas_dialog = $this->getSession()->getPage()->find('css', '.ui-dialog[aria-describedby="drupal-off-canvas"]');
    $this->assertEquals(FALSE, empty($off_canvas_dialog), 'The off-canvas dialog was found.');
    return $off_canvas_dialog;
  }

  /** * Get themes to test. * * @return string[] * Theme names to test. */
  protected function getTestThemes() {
    

  protected function instantiateServer($port$working_dir = NULL) {
    $finder = new PhpExecutableFinder();
    $working_path = $this->getWorkingPath($working_dir);
    $server = [
      $finder->find(),
      '-S',
      self::$hostName . ':' . $port,
      '-t',
      $working_path,
    ];
    if (file_exists($working_path . DIRECTORY_SEPARATOR . '.ht.router.php')) {
      $server[] = $working_path . DIRECTORY_SEPARATOR . '.ht.router.php';
    }
    $ps = new Process($server$working_path);
    $ps->setIdleTimeout(30)
      ->setTimeout(30)
      

        return $this->configReader->getByPluginName($plugin->getName()$shop);
    }

    /** * @param array $elements */
    public function savePluginConfig(Plugin $plugin$elements, ?Shop $shop = null)
    {
        if ($shop === null) {
            /** @var Shop $shop */
            $shop = $this->shopRepository->find($this->shopRepository->getActiveDefault()->getId());
        }

        $this->configWriter->savePluginConfig($plugin$elements$shop);
    }

    /** * @param string $name * * @throws Exception */
    public function saveConfigElement(Plugin $plugin$name$value, ?Shop $shop = null)
    {
/** * Helper function for sAdmin::sGetUserData() * Gets user shipping data (address, payment) * * @return array<string, mixed> */
    private function getUserShippingData(int $userId, array $userData, string $countryQuery): array
    {
        $entityManager = Shopware()->Container()->get(ModelManager::class);

        $customer = $entityManager->find(Customer::class$userId);
        if (!$customer instanceof Customer) {
            throw new \InvalidArgumentException('User with provided id not found');
        }

        $shipping = $this->getShippingAddressData($entityManager$customer);
        if ($shipping === null) {
            throw new \UnexpectedValueException('No shipping address found for user with provided userId');
        }

        $userData['shippingaddress'] = $shipping;

        
$this->files[] = $filename;

        return $filename;
    }

    protected function createCommand(): Command
    {
        $application = new Application();
        $application->add(new LintCommand());

        return $application->find('lint:yaml');
    }

    protected function createCommandTester(): CommandTester
    {
        return new CommandTester($this->createCommand());
    }

    protected function setUp(): void
    {
        $this->files = [];
        @mkdir(sys_get_temp_dir().'/framework-yml-lint-test');
    }
$block_id = $block->id();
    $this->drupalGet('user');

    $link = $web_assert->waitForElement('css', "$block_selector .contextual-links li a");
    $this->assertEquals('Quick edit', $link->getHtml(), "'Quick edit' is the first contextual link for the block.");
    $destination = (string) $this->loggedInUser->toUrl()->toString();
    $this->assertStringContainsString("/admin/structure/block/manage/$block_id/settings-tray?destination=$destination", $link->getAttribute('href'));

    if (isset($toolbar_item)) {
      // Check that you can open a toolbar tray and it will be closed after       // entering edit mode.       if ($element = $page->find('css', "#toolbar-administration a.is-active")) {
        // If a tray was open from page load close it.         $element->click();
        $web_assert->assertNoElementAfterWait('css', "#toolbar-administration a.is-active");
      }
      $page->find('css', $toolbar_item)->click();
      $this->assertElementVisibleAfterWait('css', "{$toolbar_item}.is-active");
    }
    $this->enableEditMode();
    if (isset($toolbar_item)) {
      $web_assert->assertNoElementAfterWait('css', "{$toolbar_item}.is-active");
    }
    

    public function update($id, array $params)
    {
        $this->checkPrivilege('update');

        if (empty($id)) {
            throw new ParameterMissingException('id');
        }

        $order = $this->getRepository()->find($id);

        if (!$order) {
            throw new NotFoundException(sprintf('Order by id %d not found', $id));
        }

        $params = $this->prepareOrderData($params$order);

        $order->fromArray($params);

        $violations = $this->getManager()->validate($order);
        if ($violations->count() > 0) {
            
return $media;
    }

    /** * @param int $id * * @return object|null */
    protected function getMediaById($id)
    {
        return $this->mediaResource->getRepository()->find($id);
    }

    /** * @param string $path * * @return object|null */
    protected function getMediaByPath($path)
    {
        return $this->mediaResource->getRepository()->findOneBy(['path' => $path]);
    }
}

  }

  /** * Tests table select with disabled rows. */
  public function testDisabledRows() {
    // Asserts that a row number (1 based) is enabled.     $assert_row_enabled = function D$delta) {
      $row = $this->assertSession()->elementExists('xpath', "//table/tbody/tr[$delta]");
      $this->assertFalse($row->hasClass('disabled'));
      $input = $row->find('css', 'input[value="row' . $delta . '"]');
      $this->assertFalse($input->hasAttribute('disabled'));
    };
    // Asserts that a row number (1 based) is disabled.     $assert_row_disabled = function D$delta) {
      $row = $this->assertSession()->elementExists('xpath', "//table/tbody/tr[$delta]");
      $this->assertTrue($row->hasClass('disabled'));
      $input = $row->find('css', 'input[value="row' . $delta . '"]');
      $this->assertTrue($input->hasAttribute('disabled'));
      $this->assertEquals('disabled', $input->getAttribute('disabled'));
    };

    
return Shopware()->Container()->get(LegacyStructConverter::class)->convertCategoryStruct($category);
    }

    /** * @param int $categoryId * * @return int|string */
    public function getProductBoxLayout($categoryId)
    {
        $category = $this->repository->find($categoryId);

        if (!$category instanceof CategoryModel) {
            return 'basic';
        }

        if ($category->getProductBoxLayout() !== 'extend' && $category->getProductBoxLayout() !== null) {
            return $category->getProductBoxLayout();
        }

        while (null !== $parent = $category->getParent()) {
            $category = $parent;

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