diff --git a/.gitignore b/.gitignore index 10f1a32e27..56f76dfb72 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ yarn.lock docs/css/*.map .deptrac.cache .phpunit.result.cache +code_samples/_inline_php/ diff --git a/.php-cs-fixer-factory.php b/.php-cs-fixer-factory.php new file mode 100644 index 0000000000..72a146b418 --- /dev/null +++ b/.php-cs-fixer-factory.php @@ -0,0 +1,16 @@ +withRules([ + 'header_comment' => false, +]); + +return $configFactory; diff --git a/.php-cs-fixer-inline.php b/.php-cs-fixer-inline.php new file mode 100644 index 0000000000..ced5007939 --- /dev/null +++ b/.php-cs-fixer-inline.php @@ -0,0 +1,30 @@ +withRules([ + 'psr_autoloading' => false, + 'AdamWojs/phpdoc_force_fqcn_fixer' => false, +]); + +return $configFactory + ->buildConfig() + ->setFinder( + PhpCsFixer\Finder::create() + ->in(__DIR__ . '/code_samples/_inline_php') + ->files()->name('*.php') + ); diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 38b8df8e41..b04adee758 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -6,12 +6,7 @@ */ declare(strict_types=1); -use Ibexa\CodeStyle\PhpCsFixer\InternalConfigFactory; - -$configFactory = new InternalConfigFactory(); -$configFactory->withRules([ - 'header_comment' => false, -]); +$configFactory = require __DIR__ . '/.php-cs-fixer-factory.php'; return $configFactory ->buildConfig() @@ -23,5 +18,6 @@ __DIR__ . '/tests', ], 'is_dir') ) + ->exclude('_inline_php') // handled separately by .php-cs-fixer-inline.php ->files()->name('*.php') ); diff --git a/code_samples/api/graphql/src/GraphQL/Schema/MyFieldDefinitionMapper.php b/code_samples/api/graphql/src/GraphQL/Schema/MyFieldDefinitionMapper.php index e450986329..b2a4432f86 100644 --- a/code_samples/api/graphql/src/GraphQL/Schema/MyFieldDefinitionMapper.php +++ b/code_samples/api/graphql/src/GraphQL/Schema/MyFieldDefinitionMapper.php @@ -15,6 +15,7 @@ protected function getFieldTypeIdentifier(): string return 'my_field_type'; } + #[\Override] public function mapToFieldValueInputType(ContentType $contentType, FieldDefinition $fieldDefinition): ?string { if (!$this->canMap($fieldDefinition)) { diff --git a/code_samples/catalog/custom_catalog_filter/src/CatalogFilter/DataTransformer/ProductNameCriterionTransformer.php b/code_samples/catalog/custom_catalog_filter/src/CatalogFilter/DataTransformer/ProductNameCriterionTransformer.php index fe1cad48ae..8a7837a023 100644 --- a/code_samples/catalog/custom_catalog_filter/src/CatalogFilter/DataTransformer/ProductNameCriterionTransformer.php +++ b/code_samples/catalog/custom_catalog_filter/src/CatalogFilter/DataTransformer/ProductNameCriterionTransformer.php @@ -8,6 +8,12 @@ use Symfony\Component\Form\DataTransformerInterface; use Symfony\Component\Form\Exception\TransformationFailedException; +/** + * @implements \Symfony\Component\Form\DataTransformerInterface< + * \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\ProductName, + * \Ibexa\Bundle\ProductCatalog\Form\Data\Catalog\CatalogFilterPriceData + * > + */ final class ProductNameCriterionTransformer implements DataTransformerInterface { public function transform($value): ?string diff --git a/composer.json b/composer.json index a2c6f57fb6..66381642a8 100644 --- a/composer.json +++ b/composer.json @@ -101,11 +101,25 @@ "ibexa/fastly": "~5.0.x-dev" }, "scripts": { - "fix-cs": "php-cs-fixer fix --config=.php-cs-fixer.php -v --show-progress=dots", - "check-cs": "@fix-cs --dry-run", - "phpstan": "phpstan analyse", - "deptrac": "deptrac analyse", - "check-rector": "rector process --dry-run --ansi", + "fix-cs": [ + "php tools/extract-inline-php.php", + "php-cs-fixer fix --config=.php-cs-fixer.php -v --show-progress=dots", + "php-cs-fixer fix --config=.php-cs-fixer-inline.php -v --show-progress=dots", + "php tools/sync-inline-php-to-markdown.php" + ], + "check-cs": [ + "php tools/extract-inline-php.php", + "php-cs-fixer fix --config=.php-cs-fixer.php -v --show-progress=dots --dry-run", + "php-cs-fixer fix --config=.php-cs-fixer-inline.php -v --show-progress=dots --dry-run" + ], + "phpstan": "php tools/extract-inline-php.php && phpstan analyse", + "deptrac": "php tools/extract-inline-php.php && deptrac analyse", + "fix-rector": [ + "php tools/extract-inline-php.php", + "rector process --ansi", + "php tools/sync-inline-php-to-markdown.php" + ], + "check-rector": "php tools/extract-inline-php.php && rector process --dry-run --ansi", "check-yaml": "phpunit --group yaml", "phpunit": "phpunit --exclude-group=yaml", "yaml-update-baseline": "php tests/generate-yaml-baseline.php" @@ -115,6 +129,7 @@ "check-cs": "Run code style checker for all files", "phpstan": "Run static code analysis", "deptrac": "Run Deptrac architecture testing", + "fix-rector": "Automatically applies Rector refactoring to code samples and syncs back to Markdown", "check-rector": "Check for code refactoring opportunities", "check-yaml": "Run PHPUnit tests (YAML validation)", "yaml-update-baseline": "Regenerate tests/yaml-validation-baseline.yaml from current failures" diff --git a/deptrac.baseline.yaml b/deptrac.baseline.yaml index 735af566a5..c45d47606a 100644 --- a/deptrac.baseline.yaml +++ b/deptrac.baseline.yaml @@ -174,7 +174,7 @@ deptrac: - Ibexa\Bundle\Checkout\Form\Type\AddressType - Ibexa\Bundle\Payment\Form\Type\PaymentMethodChoiceType - Ibexa\Bundle\Shipping\Form\Type\ShippingMethodChoiceType - App\GraphQL\Schema\MyCustomFieldDefinitionMapper: + App\GraphQL\Schema\MyFieldDefinitionMapper: - Ibexa\GraphQL\Schema\Domain\Content\Mapper\FieldDefinition\DecoratingFieldDefinitionMapper App\Migrations\Action\AssignSection: - Ibexa\Migration\ValueObject\Step\Action diff --git a/docs/administration/back_office/back_office_elements/extending_thumbnails.md b/docs/administration/back_office/back_office_elements/extending_thumbnails.md index 48ace7411f..2cfab513cd 100644 --- a/docs/administration/back_office/back_office_elements/extending_thumbnails.md +++ b/docs/administration/back_office/back_office_elements/extending_thumbnails.md @@ -75,7 +75,7 @@ It enables you to add a thumbnail URL in the text field. Add `FieldValueUrl.php` in `src/Thumbnails`. -```php +```php skip-validation addChild( 'all_content_list', [ @@ -105,7 +105,7 @@ You can then use the variable `custom_parameter` in `templates/themes/admin/list To have translatable labels, use `translation.key` from the `messages` domain: -``` php +``` php skip-validation $menu->addChild( 'all_content_list', [ diff --git a/docs/administration/back_office/browser/browser.md b/docs/administration/back_office/browser/browser.md index 1addc5b3d8..b16d11f74d 100644 --- a/docs/administration/back_office/browser/browser.md +++ b/docs/administration/back_office/browser/browser.md @@ -146,7 +146,7 @@ If an event listener catches additional parameters passed with context, it uses In the example below, the `johndoe` parameter enables the user to choose multiple items from a **Browser window** by changing `multiple: false` from `my_custom_udw` configuration to `multiple: true`. -```php hl_lines="29 30 31" +```php skip-validation hl_lines="29 30 31" class JohnDoeCanSelectMore implements EventSubscriberInterface { private const CONFIGURATION_NAME = 'my_custom_udw'; diff --git a/docs/administration/back_office/customize_calendar.md b/docs/administration/back_office/customize_calendar.md index 5e56e0a7cd..dcd0743900 100644 --- a/docs/administration/back_office/customize_calendar.md +++ b/docs/administration/back_office/customize_calendar.md @@ -80,7 +80,7 @@ To add an in-memory collection as an event source, create `src/Calendar/Holidays For example: - ``` php + ``` php skip-validation $collection = new EventCollection([ $this->createEvent("Event 1", new DateTime("2024-01-01")), $this->createEvent("Event 2", new DateTime("2024-01-02")), diff --git a/docs/administration/back_office/notifications.md b/docs/administration/back_office/notifications.md index 84ac4be9f8..295c3de407 100644 --- a/docs/administration/back_office/notifications.md +++ b/docs/administration/back_office/notifications.md @@ -25,7 +25,7 @@ There are four types of notifications: `info`, `success`, `warning` and `error`. To send a notification from PHP, inject the `TranslatableNotificationHandlerInterface` into your class. -``` php +``` php skip-validation $this->notificationHandler->info( /** @Desc("Notification text") */ 'example.notification.text', diff --git a/docs/administration/configuration/configuration.md b/docs/administration/configuration/configuration.md index eb26f7ec2a..0222dc3e83 100644 --- a/docs/administration/configuration/configuration.md +++ b/docs/administration/configuration/configuration.md @@ -72,7 +72,7 @@ parameters: an_array: [apple, banana, pear] ``` -``` php +``` php skip-validation // Usage inside a controller $myParameter = $this->container->getParameter( 'myapp.parameter.name' ); ``` diff --git a/docs/administration/configuration/dynamic_configuration.md b/docs/administration/configuration/dynamic_configuration.md index c847e0899d..1d45d60013 100644 --- a/docs/administration/configuration/dynamic_configuration.md +++ b/docs/administration/configuration/dynamic_configuration.md @@ -29,7 +29,7 @@ parameters: Inside a controller, in `site_group` SiteAccess, you can use the parameters in the following way (the same applies for `hasParameter()`): -``` php +``` php skip-validation $configResolver = $this->getConfigResolver();   // ibexa.site_access.config is the default namespace, so no need to specify it @@ -77,7 +77,7 @@ For more information about dependency injection, see [Service container](php_api Don't store the retrieved config value unless you know what you're doing. SiteAccess can change during code execution, which means you might work on the wrong value. -``` php +``` php skip-validation namespace App; use Ibexa\Contracts\Core\SiteAccess\ConfigResolverInterface; diff --git a/docs/administration/configuration/repository_configuration.md b/docs/administration/configuration/repository_configuration.md index 126b39e841..0e4f917508 100644 --- a/docs/administration/configuration/repository_configuration.md +++ b/docs/administration/configuration/repository_configuration.md @@ -303,7 +303,7 @@ This enables you to use different settings for different repositories. To do this, create a parser that implements `Ibexa\Bundle\Core\DependencyInjection\Configuration\RepositoryConfigParserInterface`: -``` php +``` php skip-validation use Ibexa\Bundle\Core\DependencyInjection\Configuration\RepositoryConfigParserInterface; use Symfony\Component\Config\Definition\Builder\NodeBuilder; @@ -326,7 +326,7 @@ final class CustomRepositoryConfigParser implements RepositoryConfigParserInterf You need to register this configuration extension in the following way: -``` php +``` php skip-validation final class AcmeFeatureBundle extends Bundle { public function build(ContainerBuilder $container): void @@ -342,6 +342,6 @@ final class AcmeFeatureBundle extends Bundle To access the configuration settings, use the `Ibexa\Bundle\Core\ApiLoader\RepositoryConfigurationProvider::getRepositoryConfig` method: -``` php +``` php skip-validation $acmeConfig = $repositoryConfigProvider->getRepositoryConfig()['acme']; ``` diff --git a/docs/ai_actions/configure_ai_actions.md b/docs/ai_actions/configure_ai_actions.md index 1611b11286..95de39c567 100644 --- a/docs/ai_actions/configure_ai_actions.md +++ b/docs/ai_actions/configure_ai_actions.md @@ -91,7 +91,7 @@ composer require ibexa/connector-gemini Then, if not using Symfony Flex, enable the bundle in `config/bundles.php`: -``` php +``` php skip-validation Ibexa\Bundle\ConnectorGemini\IbexaConnectorGeminiBundle::class => ['all' => true], ``` diff --git a/docs/api/graphql/graphql_custom_ft.md b/docs/api/graphql/graphql_custom_ft.md index 9010719f4c..1a4f416d5c 100644 --- a/docs/api/graphql/graphql_custom_ft.md +++ b/docs/api/graphql/graphql_custom_ft.md @@ -40,7 +40,7 @@ If not specified, it uses `FieldDefinition`. Compiler pass example that should be placed in `src/DependencyInjection/Compiler`: -``` php +``` php skip-validation [[= include_file('code_samples/api/graphql/src/DependencyInjection/Compiler/MyCustomTypeGraphQLCompilerPass.php') =]] ``` @@ -60,7 +60,8 @@ It requires that you implement the `getFieldTypeIdentifier` method to tell which Add `MyFieldDefinitionMapper.php` mapper to `src/GraphQL/Schema`: ``` php -[[= include_file('code_samples/api/graphql/src/GraphQL/Schema/MyFieldDefinitionMapper.php', 0, 16) =]][[= include_file('code_samples/api/graphql/src/GraphQL/Schema/MyFieldDefinitionMapper.php', 36, 37) =]] +[[= include_code('code_samples/api/graphql/src/GraphQL/Schema/MyFieldDefinitionMapper.php', 1, 17) =]] +[[= include_code('code_samples/api/graphql/src/GraphQL/Schema/MyFieldDefinitionMapper.php', 38, 39) =]] ``` The `FieldDefinitionMapper` interface defines following methods: @@ -75,7 +76,7 @@ When a mapper method is decorated, you need to call the decorated service method To do that, you need to replace `mapXXX` by the method it's in: ```php -[[= include_file('code_samples/api/graphql/src/GraphQL/Schema/MyFieldDefinitionMapper.php', 19, 22, remove_indent=True) =]] +[[= include_code('code_samples/api/graphql/src/GraphQL/Schema/MyFieldDefinitionMapper.php', 21, 24, remove_indent=True) =]] ``` It's required for every implemented method, so that other mappers are called for the other field types. diff --git a/docs/api/php_api/php_api.md b/docs/api/php_api/php_api.md index fe7d8b0c16..7c889e542f 100644 --- a/docs/api/php_api/php_api.md +++ b/docs/api/php_api/php_api.md @@ -108,7 +108,7 @@ You can use this method to perform an action that the current user doesn't have For example, to [hide a Location](managing_content.md#hiding-and-revealing-locations), use: -``` php +``` php skip-validation use Ibexa\Contracts\Core\Repository\Repository; //... @@ -147,7 +147,7 @@ For example if you're using a command which takes the content ID as a parameter, Both cases should be covered with error messages: -``` php +``` php skip-validation try { // ... } catch (\Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException $e) { diff --git a/docs/api/rest_api/extending_rest_api/creating_new_rest_resource.md b/docs/api/rest_api/extending_rest_api/creating_new_rest_resource.md index 37e53f8f0a..14d78b1081 100644 --- a/docs/api/rest_api/extending_rest_api/creating_new_rest_resource.md +++ b/docs/api/rest_api/extending_rest_api/creating_new_rest_resource.md @@ -68,7 +68,7 @@ If the returned value was depending on a location, it could have been wrapped in `CachedValue` is used in the following way: -```php +```php skip-validation return new CachedValue( new MyValue($args…), ['locationId'=> $locationId] diff --git a/docs/commerce/cart/cart_api.md b/docs/commerce/cart/cart_api.md index d8208d737a..b219323594 100644 --- a/docs/commerce/cart/cart_api.md +++ b/docs/commerce/cart/cart_api.md @@ -64,7 +64,7 @@ To update cart metadata, use the `CartServiceInterface::updateCartMetadata` meth You can also use this method to change cart ownership: -``` php +``` php skip-validation use Ibexa\Contracts\Cart\Value\CartMetadataUpdateStruct; // ... @@ -150,7 +150,7 @@ It can include any relevant information that you want to associate with a partic To add context data to a cart, follow this example: -```php +```php skip-validation $createStruct = new CartCreateStruct(...); $createStruct->setContext(new ArrayMap([ 'coupon_code' => 'X1MF7699', @@ -166,7 +166,7 @@ You also add "X1MF7699" coupon code as context data to the cart. To attach context data to a cart entry, proceed as follows: -```php +```php skip-validation $entryAddStruct = new EntryAddStruct(...); $entryAddStruct->setContext(new ArrayMap([ 'tshirt_text' => 'EqEqEqEq', diff --git a/docs/commerce/shopping_list/install_shopping_list.md b/docs/commerce/shopping_list/install_shopping_list.md index 6dbfc025a5..db2fdd8dad 100644 --- a/docs/commerce/shopping_list/install_shopping_list.md +++ b/docs/commerce/shopping_list/install_shopping_list.md @@ -17,7 +17,7 @@ composer require ibexa/shopping-list The associated Symfony Flex recipe configures the bundle and its routes. Check that the following line has been added by the recipe to `config/bundles.php` file's array: -```php +```php skip-validation Ibexa\Bundle\ShoppingList\IbexaShoppingListBundle::class => ['all' => true], ``` diff --git a/docs/commerce/shopping_list/shopping_list_api.md b/docs/commerce/shopping_list/shopping_list_api.md index 1fea806f89..8d85bf93cd 100644 --- a/docs/commerce/shopping_list/shopping_list_api.md +++ b/docs/commerce/shopping_list/shopping_list_api.md @@ -40,7 +40,7 @@ and with sort clauses from the [`SortClause` namespace](/api/php_api/php_api_ref To get all shopping lists (of the current user or of the whole repository depending on the current user limitation), use the search method without criterion: -```php +```php skip-validation $lists = $this->shoppingListService->findShoppingLists(new ShoppingListQuery()); ``` @@ -56,7 +56,7 @@ If you forgot to retrieve this result in your variable, the local object isn't s In the following example, if some assignments (`$list =`) are removed, the dumped `$list` object doesn't contain the stored shopping list at that time. If only the middle assignment is removed, the last dumped variable contains the up-to-date shopping list. -```php +```php skip-validation $list = $this->shoppingListService->getOrCreateDefaultShoppingList(); dump($list); $list = $this->shoppingListService->clearShoppingList($list); diff --git a/docs/commerce/storefront/configure_storefront.md b/docs/commerce/storefront/configure_storefront.md index 5d69a73251..4a220c563c 100644 --- a/docs/commerce/storefront/configure_storefront.md +++ b/docs/commerce/storefront/configure_storefront.md @@ -67,7 +67,7 @@ The basic configuration of the Storefront can look as follows: The `\Ibexa\Contracts\Storefront\Repository\CatalogResolverInterface` interface allows retrieving the product catalog available for a specific user. -```php +```php skip-validation namespace Ibexa\Contracts\Storefront\Repository; use Ibexa\Contracts\Core\Repository\Values\User\User; diff --git a/docs/commerce/storefront/extend_storefront.md b/docs/commerce/storefront/extend_storefront.md index 82fc5e0dff..302acbec33 100644 --- a/docs/commerce/storefront/extend_storefront.md +++ b/docs/commerce/storefront/extend_storefront.md @@ -99,7 +99,7 @@ After you modify the controller, it can also pass the following parameters: Define your own logic in a custom controller. Refer to the code snippet below and create your own file, for example, `CustomProductRenderController.php`: -``` php +``` php skip-validation public function renderAction(ProductInterface $product): Response { return $this->render('@ibexadesign/storefront/product_card.html.twig', [ diff --git a/docs/commerce/transactional_emails/extend_transactional_emails.md b/docs/commerce/transactional_emails/extend_transactional_emails.md index 665ed1cb9a..34f779c072 100644 --- a/docs/commerce/transactional_emails/extend_transactional_emails.md +++ b/docs/commerce/transactional_emails/extend_transactional_emails.md @@ -30,7 +30,7 @@ framework: [[= product_name =]] comes with a predefined [set of variables](transactional_emails_parameters.md) that you can use when building a template for your transactional email campaign at Actito. If this list isn't sufficient, you can use Events to include additional variables: -```php +```php skip-validation setCampaign($campaign); } } -``` \ No newline at end of file +``` diff --git a/docs/content_management/collaborative_editing/configure_collaborative_editing.md b/docs/content_management/collaborative_editing/configure_collaborative_editing.md index 268f774ff4..dd0309c25c 100644 --- a/docs/content_management/collaborative_editing/configure_collaborative_editing.md +++ b/docs/content_management/collaborative_editing/configure_collaborative_editing.md @@ -24,7 +24,7 @@ It also modifies the permission system to account for the new functionality. Then, if not using Symfony Flex, add the following code to the `config/bundles.php` file: -``` php +``` php skip-validation contentService->loadVersionInfo($contentInfo, 2); ``` @@ -169,13 +169,13 @@ The repository is SiteAccess-aware, so languages defined by the SiteAccess are a To load a specific language, provide its language code when loading the content item: -``` php +``` php skip-validation $content = $this->contentService->loadContent($contentId, ['ger-DE']); ``` To load all languages as a prioritized list, use `Language::ALL`: -``` php +``` php skip-validation $contentService->loadContent($content->id, Language::ALL); ``` @@ -202,7 +202,7 @@ You can do it through the `getMainLocation` method of the ContentInfo object. Next, use the `getParentLocation` method of the location object to access the parent location: -``` php +``` php skip-validation $mainLocation = $contentInfo->getMainLocation(); $output->writeln("Parent Location: " . $mainLocation->getParentLocation()->pathString); ``` @@ -222,7 +222,7 @@ The versions must have the same language. For example, to get the comparison between the `name` field of two versions: -```php +```php skip-validation $versionFrom = $this->contentService->loadVersionInfo($contentInfo, $versionFromId); $versionTo = $this->contentService->loadVersionInfo($contentInfo, $versionToId); diff --git a/docs/content_management/content_api/creating_content.md b/docs/content_management/content_api/creating_content.md index bed7373eb5..3c1a6f9936 100644 --- a/docs/content_management/content_api/creating_content.md +++ b/docs/content_management/content_api/creating_content.md @@ -103,6 +103,6 @@ Only one language can still be set as a version's initial language: You can delete a single translation from a content item's version using [`ContentService::deleteTranslationFromDraft`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-ContentService.html#method_deleteTranslationFromDraft). The method must be provided with a `VersionInfo` object and the code of the language to delete: -``` php +``` php skip-validation $this->contentService->deleteTranslationFromDraft($versionInfo, $language); ``` diff --git a/docs/content_management/content_api/managing_content.md b/docs/content_management/content_api/managing_content.md index 976b53354c..19308434a3 100644 --- a/docs/content_management/content_api/managing_content.md +++ b/docs/content_management/content_api/managing_content.md @@ -116,7 +116,7 @@ Trash location is identical to the origin location of the object. The content item is restored under its previous location. You can also provide a different location to restore in as a second argument: -``` php +``` php skip-validation $newParent = $this->locationService->loadLocation($location); $this->trashService->recover($trashItem, $newParent); ``` diff --git a/docs/content_management/field_types/field_type_reference/addressfield.md b/docs/content_management/field_types/field_type_reference/addressfield.md index d374937caa..ed218cc897 100644 --- a/docs/content_management/field_types/field_type_reference/addressfield.md +++ b/docs/content_management/field_types/field_type_reference/addressfield.md @@ -27,7 +27,7 @@ provided by the `ibexa/fieldtype-address` package. ### Example input -```php +```php skip-validation new FieldType\Value( 'My home address', 'PL', @@ -112,7 +112,7 @@ ibexa.address.field.tax_number.billing_address.DE An event listener can also provide validation by using either one of [constraints provided by Symfony]([[= symfony_doc =]]/validation.html#supported-constraints), or a custom constraint. -```php +```php skip-validation use Ibexa\Contracts\FieldTypeAddress\Event\MapFieldEvent; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\Form\Extension\Core\Type\IntegerType; diff --git a/docs/content_management/field_types/field_type_reference/authorfield.md b/docs/content_management/field_types/field_type_reference/authorfield.md index c26c2dcb11..1075e23f42 100644 --- a/docs/content_management/field_types/field_type_reference/authorfield.md +++ b/docs/content_management/field_types/field_type_reference/authorfield.md @@ -18,7 +18,7 @@ This field type allows the storage and retrieval of one or more authors. For eac Example: -``` php +``` php skip-validation $authorList = Author\Value([ new Author\Author([ 'id' => 1, @@ -39,7 +39,7 @@ The hash format mostly matches the value object. It has the following key `autho Example -``` php +``` php skip-validation [ [ 'id' => 1, @@ -79,7 +79,7 @@ Following `defaultAuthor` default value options are available as constants in | `DEFAULT_VALUE_EMPTY` | Default value is empty. | | `DEFAULT_CURRENT_USER` | Default value uses currently logged user. | -``` php +``` php skip-validation // Author field type example settings use Ibexa\Core\FieldType\Author\Type; diff --git a/docs/content_management/field_types/field_type_reference/binaryfilefield.md b/docs/content_management/field_types/field_type_reference/binaryfilefield.md index 3b7d612234..d7ede4eb14 100644 --- a/docs/content_management/field_types/field_type_reference/binaryfilefield.md +++ b/docs/content_management/field_types/field_type_reference/binaryfilefield.md @@ -46,7 +46,7 @@ The hash format mostly matches the value object. It has the following keys: Example: -```php +```php skip-validation $fileContentCreateStruct->setField('file', new Ibexa\Core\FieldType\BinaryFile\Value([ 'fileName' => 'example.pdf', 'inputUri' => '/tmp/example_for_website.pdf', diff --git a/docs/content_management/field_types/field_type_reference/checkboxfield.md b/docs/content_management/field_types/field_type_reference/checkboxfield.md index 54380b2469..e27efd105d 100644 --- a/docs/content_management/field_types/field_type_reference/checkboxfield.md +++ b/docs/content_management/field_types/field_type_reference/checkboxfield.md @@ -18,7 +18,7 @@ The Value class of this field type contains the following properties: |----------|-----------|---------------|--------------------------------------------------------------------------------| | `$bool` | `boolean` | `false` | This property is used for the checkbox status, represented by a boolean value. | -``` php +``` php skip-validation //Value object content examples use Ibexa\Core\FieldType\Checkbox\Type; @@ -36,7 +36,7 @@ $value->bool = false; The `Checkbox\Value` constructor accepts a boolean value: -``` php +``` php skip-validation // Constructor example use Ibexa\Core\FieldType\Checkbox\Type; diff --git a/docs/content_management/field_types/field_type_reference/countryfield.md b/docs/content_management/field_types/field_type_reference/countryfield.md index 521b06bd94..bea0059542 100644 --- a/docs/content_management/field_types/field_type_reference/countryfield.md +++ b/docs/content_management/field_types/field_type_reference/countryfield.md @@ -12,7 +12,7 @@ This field type represents one or multiple countries. Example array: -``` php +``` php skip-validation [ "JP" => [ "Name" => "Japan", @@ -37,7 +37,7 @@ The field definition of this field type can be configured with one option: |--------------|-----------|---------------|--------------------------------------------------------------------------------------------| | `isMultiple` | `boolean` | `false` | This setting allows (if true) or prohibits (if false) the selection of multiple countries. | -``` php +``` php skip-validation // Country FieldType example settings $settings = [ "isMultiple" => true @@ -49,7 +49,7 @@ $settings = [ The format used for serialization is simpler than the full format. It's also available when setting value on the content field, by setting the value to an array instead of the value object. Example of that shown below: -``` php +``` php skip-validation // Value object content example $content->fields["countries"] = [ "JP", "NO" ]; ``` @@ -66,7 +66,7 @@ The Value class of this field type contains the following properties: |--------------|-----------|---------------------------------------------------------------------------------------| | `$countries` | `array[]` | This property is used for the country selection provided as input, as its attributes. | -``` php +``` php skip-validation // Value object content example $value->countries = [ "JP" => [ @@ -83,7 +83,7 @@ $value->countries = [ The `Country\Value` constructor initializes a new value object with the value provided. It expects an array as input. -``` php +``` php skip-validation // Constructor example // Instantiates a Country Value object diff --git a/docs/content_management/field_types/field_type_reference/dateandtimefield.md b/docs/content_management/field_types/field_type_reference/dateandtimefield.md index d0d5e3fd25..7c9124cb20 100644 --- a/docs/content_management/field_types/field_type_reference/dateandtimefield.md +++ b/docs/content_management/field_types/field_type_reference/dateandtimefield.md @@ -59,7 +59,7 @@ Hash value of this field type is an array with two keys: | `timestamp` | `integer` | Time information in [Unix format timestamp](https://en.wikipedia.org/wiki/Unix_time). | `1400856992` | | `rfc850` | `string` | Time information as a string in [RFC 850 date format](https://datatracker.ietf.org/doc/html/rfc850). As input, this has precedence over the timestamp value. | `"Friday, 23-May-14 14:56:14 GMT+0000"` | -``` php +``` php skip-validation $hash = [ "timestamp" => 1400856992, "rfc850" => "Friday, 23-May-14 14:56:14 GMT+0000" @@ -88,7 +88,7 @@ Following `defaultType` default value options are available as constants in the | `DEFAULT_CURRENT_DATE` | Default value uses current date. | | `DEFAULT_CURRENT_DATE_ADJUSTED` | Default value uses current date, adjusted by the interval defined in `dateInterval` setting. | -``` php +``` php skip-validation // DateAndTime FieldType example settings use Ibexa\Core\FieldType\DateAndTime\Type; @@ -110,6 +110,6 @@ The template called by the [`ibexa_render_field()` Twig function](field_twig_fun Example: -``` php +``` php skip-validation {{ ibexa_render_field(content, 'datetime') }} ``` diff --git a/docs/content_management/field_types/field_type_reference/datefield.md b/docs/content_management/field_types/field_type_reference/datefield.md index 415f9153c4..54b89fdd77 100644 --- a/docs/content_management/field_types/field_type_reference/datefield.md +++ b/docs/content_management/field_types/field_type_reference/datefield.md @@ -61,7 +61,7 @@ Hash value of this field type is an array with two keys: | `timestamp` | `integer` | Time information in [unix format timestamp](https://en.wikipedia.org/wiki/Unix_time). | `1400856992` | | `rfc850` | `string` | Time information as a string in [RFC 850 date format](https://datatracker.ietf.org/doc/html/rfc850). As input, this has higher precedence over the timestamp value. | `"Friday, 23-May-14 14:56:14 GMT+0000"` | -``` php +``` php skip-validation // Example of the hash value in PHP $hash = [ "timestamp" => 1400856992, @@ -88,7 +88,7 @@ Following `defaultType` default value options are available as constants in the | `DEFAULT_EMPTY` | Default value is empty. | | `DEFAULT_CURRENT_DATE` | Default value uses current date. | -``` php +``` php skip-validation // Date field type example settings use Ibexa\Core\FieldType\Date\Type; diff --git a/docs/content_management/field_types/field_type_reference/emailaddressfield.md b/docs/content_management/field_types/field_type_reference/emailaddressfield.md index db376e9eee..95cdfe4f61 100644 --- a/docs/content_management/field_types/field_type_reference/emailaddressfield.md +++ b/docs/content_management/field_types/field_type_reference/emailaddressfield.md @@ -18,7 +18,7 @@ The `Value` class of this field type contains the following properties: |----------|----------|-----------------------------------------------------------------------| | `$email` | `string` | This property is used for the input string provided as email address. | -``` php +``` php skip-validation // Value object content example use Ibexa\Core\FieldType\EmailAddress\Type; @@ -35,7 +35,7 @@ $emailaddressValue->email = "someuser@example.com"; The `EmailAddress\Value` constructor initializes a new value object with the value provided. It accepts a string as input. -``` php +``` php skip-validation // Constructor example use Ibexa\Core\FieldType\EmailAddress\Type; diff --git a/docs/content_management/field_types/field_type_reference/floatfield.md b/docs/content_management/field_types/field_type_reference/floatfield.md index ec09b0eeaf..e5b8047756 100644 --- a/docs/content_management/field_types/field_type_reference/floatfield.md +++ b/docs/content_management/field_types/field_type_reference/floatfield.md @@ -27,7 +27,7 @@ The Value class of this field type contains the following properties: |----------|---------|---------------------------------------------------------------| | `$value` | `float` | This property is used to store the value provided as a float. | -``` php +``` php skip-validation // Value object content example use Ibexa\Core\FieldType\Float\Type; @@ -43,7 +43,7 @@ $float->value = 284.773 The `Float\Value` constructor initializes a new value object with the value provided. It expects a numeric value with or without decimals. -``` php +``` php skip-validation // Constructor example use Ibexa\Core\FieldType\Float\Type; @@ -61,7 +61,7 @@ This field type supports `FloatValueValidator`, defining maximum and minimum flo | `minFloatValue` | `float` | `null | This setting defines the minimum value this field type which is allowed as input. | | `maxFloatValue` | `float` | `null | This setting defines the maximum value this field type which is allowed as input. | -``` php +``` php skip-validation // Validator configuration example in PHP use Ibexa\Core\FieldType\Float\Type; diff --git a/docs/content_management/field_types/field_type_reference/imageassetfield.md b/docs/content_management/field_types/field_type_reference/imageassetfield.md index 65da261fd9..88f5c4d9e3 100644 --- a/docs/content_management/field_types/field_type_reference/imageassetfield.md +++ b/docs/content_management/field_types/field_type_reference/imageassetfield.md @@ -29,7 +29,7 @@ Value object of `ibexa_image_asset` contains the following properties: | `destinationContentId` | `int` | Related content ID. | | `alternativeText` | `string` | The alternative image text (for example "Picture of an apple."). | -``` php +``` php skip-validation // Value object content example $imageAssetValue->destinationContentId = $contentInfo->id; @@ -41,7 +41,7 @@ $imageAssetValue->alternativeText = "Picture of an apple."; The `ImageAsset\Value` constructor initializes a new value object with the value provided. It expects an ID of a content item representing asset and the alternative text. -``` php +``` php skip-validation // Constructor example // Instantiates a ImageAsset Value object diff --git a/docs/content_management/field_types/field_type_reference/imagefield.md b/docs/content_management/field_types/field_type_reference/imagefield.md index 3752a8bef1..ad8347118e 100644 --- a/docs/content_management/field_types/field_type_reference/imagefield.md +++ b/docs/content_management/field_types/field_type_reference/imagefield.md @@ -149,7 +149,7 @@ Requested through REST, this resource generates the variation if it doesn't exis The variation service, `ibexa.field_type.ibexa_image.variation_service`, can be used to generate/get variations for a field. It expects a VersionInfo, the Image field, and the variation name as a string (`large`, `medium`, and more.): -``` php +``` php skip-validation $variation = $imageVariationHandler->getVariation( $imageField, $versionInfo, 'large' ); @@ -164,7 +164,7 @@ echo $variation->uri; As for any field type, there are several ways to input content to a field. For an Image, the quickest is to call `setField()` on the ContentStruct: -``` php +``` php skip-validation $createStruct = $contentService->newContentCreateStruct( $contentTypeService->loadContentType( 'image' ), 'eng-GB' @@ -176,7 +176,7 @@ $createStruct->setField( 'image', '/tmp/image.png' ); To customize the Image's alternative texts, you must first get an `Image\Value` object, and set this property. For that, you can use the `Image\Value::fromString()` method that accepts the path to a local file: -``` php +``` php skip-validation $createStruct = $contentService->newContentCreateStruct( $contentTypeService->loadContentType( 'image' ), 'eng-GB' @@ -189,7 +189,7 @@ $createStruct->setField( 'image', $imageField ); You can also provide a hash of `Image\Value` properties, either to `setField()`, or to the constructor: -``` php +``` php skip-validation $imageValue = new \Ibexa\Core\FieldType\Image\Value( [ 'id' => '/tmp/image.png', diff --git a/docs/content_management/field_types/field_type_reference/integerfield.md b/docs/content_management/field_types/field_type_reference/integerfield.md index c1eb8f3b9d..7555e9cf40 100644 --- a/docs/content_management/field_types/field_type_reference/integerfield.md +++ b/docs/content_management/field_types/field_type_reference/integerfield.md @@ -24,7 +24,7 @@ The Value class of this field type contains the following properties: |----------|-------|------------| | `$value` | `int` | This property is used to store the value provided as an integer. | -``` php +``` php skip-validation // Value object content example $integer->value = 8 ``` @@ -34,7 +34,7 @@ $integer->value = 8 The `Integer\Value` constructor initializes a new value object with the value provided. It expects a numeric, integer value. -``` php +``` php skip-validation // Constructor example use Ibexa\Core\FieldType\Integer; @@ -63,7 +63,7 @@ This field type supports `IntegerValueValidator`, defining maximum and minimum f |`minIntegerValue`|`int`|`0`|This setting defines the minimum value this field type which is allowed as input.| |`maxIntegerValue`|`int`|`null`|This setting defines the maximum value this field type which is allowed as input.| -``` php +``` php skip-validation // Example of validator configuration in PHP $validatorConfiguration = [ "minIntegerValue" => 1, diff --git a/docs/content_management/field_types/field_type_reference/isbnfield.md b/docs/content_management/field_types/field_type_reference/isbnfield.md index 8b4baf9c51..fc6806a403 100644 --- a/docs/content_management/field_types/field_type_reference/isbnfield.md +++ b/docs/content_management/field_types/field_type_reference/isbnfield.md @@ -32,7 +32,7 @@ It accepts a string as argument and sets it to the `isbn` attribute. The input passed into this field type is subject of ISBN validation depending on the field settings in its FieldDefinition stored in the content type. An example of this field setting is shown below and controls if input is validated as ISBN-13 or ISBN-10: -``` php +``` php skip-validation Array ( [isISBN13] => true diff --git a/docs/content_management/field_types/field_type_reference/keywordfield.md b/docs/content_management/field_types/field_type_reference/keywordfield.md index 1d1d09b35f..3fa9e8e82c 100644 --- a/docs/content_management/field_types/field_type_reference/keywordfield.md +++ b/docs/content_management/field_types/field_type_reference/keywordfield.md @@ -26,7 +26,7 @@ The Value class of this field type contains the following properties: |----------|------------|----------------------------------------| | `$value` | `string[]` | Holds an array of keywords as strings. | -``` php +``` php skip-validation // Value object content example use Ibexa\Core\FieldType\Keyword\Value; @@ -43,7 +43,7 @@ The `Keyword\Value` constructor initializes a new value object with the value pr It expects a list of keywords, either comma-separated in a string or as an array of strings. -``` php +``` php skip-validation // Constructor example use Ibexa\Core\FieldType\Keyword\Value; diff --git a/docs/content_management/field_types/field_type_reference/maplocationfield.md b/docs/content_management/field_types/field_type_reference/maplocationfield.md index feaf4ef115..23c3f5e300 100644 --- a/docs/content_management/field_types/field_type_reference/maplocationfield.md +++ b/docs/content_management/field_types/field_type_reference/maplocationfield.md @@ -36,7 +36,7 @@ The Value class of this field type contains the following properties: The `MapLocation\Value` constructor initializes a new value object with values provided as hash. Accepted keys are `latitude` (`float`), `longitude` (`float`), `address` (`string`). -``` php +``` php skip-validation // Constructor example // Instantiates a MapLocation Value object diff --git a/docs/content_management/field_types/field_type_reference/matrixfield.md b/docs/content_management/field_types/field_type_reference/matrixfield.md index 1542ceeebd..771ebcde3a 100644 --- a/docs/content_management/field_types/field_type_reference/matrixfield.md +++ b/docs/content_management/field_types/field_type_reference/matrixfield.md @@ -18,7 +18,7 @@ The Matrix field type is available via the Matrix Bundle provided by the [ibexa/ Example of input: -```php +```php skip-validation new FieldType\Value([ new FieldType\Value\Row(['col1' => 'Row 1, Col 1', 'col2' => 'Row 1, Col 2']), new FieldType\Value\Row(['col1' => 'Row 2, Col 1', 'col2' => 'Row 2, Col 2']), @@ -46,7 +46,7 @@ If, after removing empty rows, the number of rows doesn't fulfill the configured For example, the following input doesn't validate if `Minimum number of rows` is set to 3, because the second row is empty: -```php +```php skip-validation new FieldType\Value([ new FieldType\Value\Row(['col1' => 'Row 1, Col 1', 'col2' => 'Row 1, Col 2']), new FieldType\Value\Row(['col1' => '', 'col2' => '']), diff --git a/docs/content_management/field_types/field_type_reference/measurementfield.md b/docs/content_management/field_types/field_type_reference/measurementfield.md index 5db02da753..1d27b04878 100644 --- a/docs/content_management/field_types/field_type_reference/measurementfield.md +++ b/docs/content_management/field_types/field_type_reference/measurementfield.md @@ -42,7 +42,7 @@ As its first argument it accepts an object of `Ibexa\Contracts\Measurement\Value Depending on the selected input type, the object resembles the following examples: -``` php +``` php skip-validation // Simple input (single value) example // @var MeasurementServiceInterface $measurementService @@ -57,7 +57,7 @@ $measurementValue = new Measurement\Value( ); ``` -``` php +``` php skip-validation // Range input value example // @var MeasurementServiceInterface $measurementService diff --git a/docs/content_management/field_types/field_type_reference/mediafield.md b/docs/content_management/field_types/field_type_reference/mediafield.md index 42c04d15b9..2da67d7871 100644 --- a/docs/content_management/field_types/field_type_reference/mediafield.md +++ b/docs/content_management/field_types/field_type_reference/mediafield.md @@ -71,7 +71,7 @@ The field type supports `FileSizeValidator`, defining maximum size of media file |------|------|------|------| |`maxFileSize`|`int`|`false`|Maximum size of the file in bytes.| -``` php +``` php skip-validation // Example of using Media field type validator in PHP use Ibexa\Core\FieldType\Media\Type; @@ -107,7 +107,7 @@ List of all available `mediaType` constants is defined in the `Ibexa\Core\FieldT | `TYPE_HTML5_VIDEO` | HTML5 Video | | `TYPE_HTML5_AUDIO` | HTML5 Audio | -``` php +``` php skip-validation // Example of using Media field type settings in PHP use Ibexa\Core\FieldType\Media\Type; diff --git a/docs/content_management/field_types/field_type_reference/relationfield.md b/docs/content_management/field_types/field_type_reference/relationfield.md index 6f8b9a8543..8ecc910059 100644 --- a/docs/content_management/field_types/field_type_reference/relationfield.md +++ b/docs/content_management/field_types/field_type_reference/relationfield.md @@ -25,7 +25,7 @@ The Value class of this field type contains the following properties: |------------------------|-------------------|-------------------------------------------------------------------------------------------| | `$destinationContentId` | `string|int|null` | This property is used to store the value provided, which represents the related content. | -``` php +``` php skip-validation // Value object content example $relation->destinationContentId = $contentInfo->id; @@ -35,7 +35,7 @@ $relation->destinationContentId = $contentInfo->id; The `Relation\Value` constructor initializes a new value object with the value provided. It expects a mixed value. -``` php +``` php skip-validation // Constructor example // Instantiates a Relation Value object @@ -56,7 +56,7 @@ The field definition of this field type can be configured with three options: | `selectionRoot` | `string` | `null` | This setting defines the selection root. | | `selectionContentTypes` | `array` | `[]` | An array of content type IDs that are allowed for related Content. | -``` php +``` php skip-validation // Relation FieldType example settings use Ibexa\Core\FieldType\Relation\Type; diff --git a/docs/content_management/field_types/field_type_reference/relationlistfield.md b/docs/content_management/field_types/field_type_reference/relationlistfield.md index f920a2a9ae..4dbd7eac9e 100644 --- a/docs/content_management/field_types/field_type_reference/relationlistfield.md +++ b/docs/content_management/field_types/field_type_reference/relationlistfield.md @@ -27,7 +27,7 @@ This field type makes it possible to store and retrieve values of a relation to |------|------|------|------| |`destinationContentIds`|`array`|An array of related Content IDs|`[ 24, 42 ]`| -``` php +``` php skip-validation // Value object content example $relationList->destinationContentId = [ $contentInfo1->id, @@ -41,7 +41,7 @@ $relationList->destinationContentId = [ The `RelationList\Value` constructor initializes a new value object with the value provided. It expects a mixed array as value. -``` php +``` php skip-validation //Constructor example // Instantiates a RelationList Value object @@ -90,7 +90,7 @@ Following selection methods are available: |------|------|------|------| |`RelationListValueValidator[selectionLimit]`|`integer`|`0`|The number of content items that can be selected in the field. When set to 0, any number can be selected.| -``` php +``` php skip-validation // Example of using settings and validators configuration in PHP use Ibexa\Core\FieldType\RelationList\Type; diff --git a/docs/content_management/field_types/field_type_reference/richtextfield.md b/docs/content_management/field_types/field_type_reference/richtextfield.md index 1729dbffd2..b34ad87db7 100644 --- a/docs/content_management/field_types/field_type_reference/richtextfield.md +++ b/docs/content_management/field_types/field_type_reference/richtextfield.md @@ -70,7 +70,7 @@ You can use the [[= product_name_base =]] flavor of the DocBook format in PHP AP The following example shows how to pass DocBook content to a [create struct](creating_content.md#creating-content-item-draft): -``` php +``` php skip-validation $contentCreateStruct = $contentService->newContentCreateStruct( $contentType, "eng-GB" ); $inputString = <<selection = [ 1, 4, 5 ]; The `Selection\Value` constructor accepts an array of selected element identifiers. -``` php +``` php skip-validation // Constructor example // Instanciates a selection value with items #1 and #2 selected @@ -55,7 +55,7 @@ Example: `"1,2,24,42"` Hash format of this field type is the same as value object's `selection` property. -``` php +``` php skip-validation // Example of value in hash format $hash = [ 1, 2 ]; @@ -74,7 +74,7 @@ When option validation fails, a list with the invalid options is also presented. | `isMultiple` | `boolean` | `false` | Used to allow or prohibit multiple selection from the option list. | | `options` | `hash` | `[]` | Stores the list of options defined in the field definition. | -``` php +``` php skip-validation // Selection field type example settings use Ibexa\Core\FieldType\Selection\Type; diff --git a/docs/content_management/field_types/field_type_reference/taxonomyentryassignmentfield.md b/docs/content_management/field_types/field_type_reference/taxonomyentryassignmentfield.md index 476c043d1f..b5b34973b7 100644 --- a/docs/content_management/field_types/field_type_reference/taxonomyentryassignmentfield.md +++ b/docs/content_management/field_types/field_type_reference/taxonomyentryassignmentfield.md @@ -23,7 +23,7 @@ To be able to assign tags to the content, first, you need to add a `TaxonomyEntr | `array` | array with `Ibexa\Contracts\Taxonomy\Value\TaxonomyEntry` objects under `taxonomy_entries` key and Taxonomy identifier under `taxonomy` key | see below | Example using an `Ibexa\Taxonomy\FieldType\TaxonomyEntryAssignment\Value` object: -``` php +``` php skip-validation $taxonomyEntry1 = $this->taxonomyService->loadEntryByIdentifier('example_entry', 'tags'); $taxonomyEntry2 = $this->taxonomyService->loadEntryByIdentifier('example_entry_2', 'tags'); new \Ibexa\Taxonomy\FieldType\TaxonomyEntryAssignment\Value( @@ -37,7 +37,7 @@ new \Ibexa\Taxonomy\FieldType\TaxonomyEntryAssignment\Value( ``` Example using array: -``` php +``` php skip-validation [ 'taxonomy_entries' => [$taxonomyEntry, $taxonomyEntry2], // load entries using TaxonomyService 'taxonomy' => 'tags', diff --git a/docs/content_management/field_types/field_type_reference/taxonomyentryfield.md b/docs/content_management/field_types/field_type_reference/taxonomyentryfield.md index 1fdbb9ec8b..51d094be10 100644 --- a/docs/content_management/field_types/field_type_reference/taxonomyentryfield.md +++ b/docs/content_management/field_types/field_type_reference/taxonomyentryfield.md @@ -17,7 +17,7 @@ A `TaxonomyEntry` field accepts an array with an `Ibexa\Contracts\Taxonomy\Value | `array` | array with an `Ibexa\Contracts\Taxonomy\Value\TaxonomyEntry` object under the `taxonomy_entry` key | see below | Example using an `Ibexa\Taxonomy\FieldType\TaxonomyEntry\Value` object: -``` php +``` php skip-validation $taxonomyEntry = $this->taxonomyService->loadEntryByIdentifier('example_entry', 'tags'); new \Ibexa\Taxonomy\FieldType\TaxonomyEntry\Value( new \Ibexa\Contracts\Taxonomy\Value\TaxonomyEntry( @@ -26,7 +26,7 @@ new \Ibexa\Taxonomy\FieldType\TaxonomyEntry\Value( ); ``` Example using array: -``` php +``` php skip-validation [ 'taxonomy_entry' => $taxonomyEntry, // load Entry using TaxonomyService ] @@ -44,7 +44,7 @@ Example using array: The constructor accepts an `Ibexa\Contracts\Taxonomy\Value\TaxonomyEntry` object. -``` php +``` php skip-validation // Constructor example use Ibexa\Taxonomy\FieldType\TaxonomyEntry; diff --git a/docs/content_management/field_types/field_type_reference/textlinefield.md b/docs/content_management/field_types/field_type_reference/textlinefield.md index 7867869265..b91b407874 100644 --- a/docs/content_management/field_types/field_type_reference/textlinefield.md +++ b/docs/content_management/field_types/field_type_reference/textlinefield.md @@ -35,7 +35,7 @@ The length of the string provided must be between the minimum length defined in The default value for both properties is 0, which means that the validation is disabled by default. To set the validation properties, the `validateValidatorConfiguration()` method needs to be inspected, which receives an array with `minStringLength` and `maxStringLength` like in the following representation: -```php +```php skip-validation [ 'StringLengthValidator' => [ 'maxStringLength' => 60 diff --git a/docs/content_management/field_types/field_type_reference/timefield.md b/docs/content_management/field_types/field_type_reference/timefield.md index 8fc0bd7916..45c7bdb52f 100644 --- a/docs/content_management/field_types/field_type_reference/timefield.md +++ b/docs/content_management/field_types/field_type_reference/timefield.md @@ -70,7 +70,7 @@ The Field definition of this field type can be configured with several options: | `useSeconds` | `boolean` | `false` | Used to control displaying of seconds in the output. | | `defaultType` | `Type::DEFAULT_EMPTY Type::DEFAULT_CURRENT_TIME` | `Type::DEFAULT_EMPTY` | The constant used here defines default input value when using back-end interface. | -``` php +``` php skip-validation // Time field type example settings use Ibexa\Core\FieldType\Time\Type; diff --git a/docs/content_management/field_types/field_type_reference/urlfield.md b/docs/content_management/field_types/field_type_reference/urlfield.md index 5a29baa0e2..a9c80f930b 100644 --- a/docs/content_management/field_types/field_type_reference/urlfield.md +++ b/docs/content_management/field_types/field_type_reference/urlfield.md @@ -27,7 +27,7 @@ The Value class of this field type contains the following properties: | `$link` | `string` | This property stores the link provided to the value of this field type. | | `$text` | `string` | This property stores the text to represent the stored link provided to the value of this field type. | -``` php +``` php skip-validation // Value object content example $url->link = "https://www.ibexa.co"; @@ -39,7 +39,7 @@ $url->text = "Ibexa"; The `Url\Value` constructor initializes a new value object with the provided value. It expects two comma-separated strings, corresponding to the link and text. -``` php +``` php skip-validation // Constructor example // Instantiates an Url Value object @@ -52,7 +52,7 @@ $UrlValue = new Url\Value( "https://www.ibexa.co/", "Ibexa" ); | `link` | `string` | Link content. | "https://www.ibexa.co/" | | `text` | `string` | Text content. | "Ibexa" | -```php +```php skip-validation // Example of the hash value in PHP $hash = [ "link" => "https://www.ibexa.co/", diff --git a/docs/content_management/field_types/field_type_search.md b/docs/content_management/field_types/field_type_search.md index 807726cb40..bf6f7e5233 100644 --- a/docs/content_management/field_types/field_type_search.md +++ b/docs/content_management/field_types/field_type_search.md @@ -21,7 +21,7 @@ They're described below in further detail. To be able to query data properly an indexable field type also is required to return search specification. You must return an associative array of `Ibexa\Contracts\Core\Search\FieldType` instances from this method, which could look like: -```php +```php skip-validation [ 'url' => new Search\FieldType\StringField(), 'text' => new Search\FieldType\StringField(), diff --git a/docs/content_management/field_types/field_type_validation.md b/docs/content_management/field_types/field_type_validation.md index d2f9a5553a..f5e721b3ac 100644 --- a/docs/content_management/field_types/field_type_validation.md +++ b/docs/content_management/field_types/field_type_validation.md @@ -17,7 +17,7 @@ except it has an additional level, to group settings for a certain validation me For example, for the `ibexa_string` type, the validator schema could be: -``` php +``` php skip-validation [ 'stringLength' => [ 'minStringLength' => [ diff --git a/docs/content_management/field_types/form_and_template.md b/docs/content_management/field_types/form_and_template.md index b5f0eba859..e264a36e0d 100644 --- a/docs/content_management/field_types/form_and_template.md +++ b/docs/content_management/field_types/form_and_template.md @@ -23,7 +23,7 @@ The `FieldValueFormMapperInterface::mapFieldValueForm` method accepts two argume You have to add your form type to the content editing form. The example shows how `ibexa_boolean` injects the form: -``` php +``` php skip-validation use Ibexa\Contracts\ContentForms\Data\Content\FieldData; use Ibexa\ContentForms\Form\Type\FieldType\CheckboxFieldType; use Symfony\Component\Form\FormInterface; @@ -63,7 +63,7 @@ You can use a [`DataTransformer`]([[= symfony_doc =]]/form/data_transformers.htm Providing definition editing support is almost identical to creating content editing support. The only difference are field names: -``` php +``` php skip-validation use Ibexa\AdminUi\Form\Data\FieldDefinitionData; use Ibexa\ContentForms\Form\Type\FieldType\CountryFieldType; use Symfony\Component\Form\Extension\Core\Type\CheckboxType; diff --git a/docs/content_management/field_types/type_and_value.md b/docs/content_management/field_types/type_and_value.md index fb55abd5b2..0a0a7d1374 100644 --- a/docs/content_management/field_types/type_and_value.md +++ b/docs/content_management/field_types/type_and_value.md @@ -168,7 +168,7 @@ It's recommended to use a simple associative array format for the settings schem An example schema could look like this: -``` php +``` php skip-validation [ 'backupData' => [ 'type' => 'bool', diff --git a/docs/content_management/file_management/file_management.md b/docs/content_management/file_management/file_management.md index bedce65245..f979189711 100644 --- a/docs/content_management/file_management/file_management.md +++ b/docs/content_management/file_management/file_management.md @@ -8,7 +8,7 @@ description: Configurations and management of binary files. To access binary files from the PHP API, use the `Ibexa\Core\IO\IOServiceInterface::loadBinaryFile()` method: -```php +```php skip-validation $file = $this->ioService->loadBinaryFile($field->value->id); $fileContent = $this->ioService->getFileContents($file); ``` diff --git a/docs/content_management/images/configure_image_editor.md b/docs/content_management/images/configure_image_editor.md index ed37e270ec..fd778d5a20 100644 --- a/docs/content_management/images/configure_image_editor.md +++ b/docs/content_management/images/configure_image_editor.md @@ -51,7 +51,7 @@ By default, additional information stores the coordinates of the [focal point]([ To modify the value of additional information programmatically, you can set a value of the `Image` field by using the PHP API, for example: -``` php +``` php skip-validation new FieldValue([ 'data' => [ 'width' => '100', diff --git a/docs/content_management/taxonomy/taxonomy_api.md b/docs/content_management/taxonomy/taxonomy_api.md index 613abecde4..6518a25ca0 100644 --- a/docs/content_management/taxonomy/taxonomy_api.md +++ b/docs/content_management/taxonomy/taxonomy_api.md @@ -20,7 +20,7 @@ and use `TaxonomyServiceInterface::loadEntryByIdentifier()`: !!! note A taxonomy entry identifier is unique per taxonomy. If you have [several taxonomies](taxonomy.md#customize-taxonomy-structure), you can increase code readability by always passing the taxonomy identifier even when it's the default one. The default taxonomy is `tags` if it exists, else the first configured taxonomy (see `\Ibexa\Taxonomy\Service\TaxonomyConfiguration::getDefaultTaxonomyName` for details). - ``` php + ``` php skip-validation $springs[] = $this->taxonomyService->loadEntryByIdentifier('spring', 'tags'); $springs[] = $this->taxonomyService->loadEntryByIdentifier('spring', 'events'); $springs[] = $this->taxonomyService->loadEntryByIdentifier('spring', 'devices'); diff --git a/docs/content_management/url_management/url_management.md b/docs/content_management/url_management/url_management.md index ed56dadc75..1f48ab0536 100644 --- a/docs/content_management/url_management/url_management.md +++ b/docs/content_management/url_management/url_management.md @@ -102,7 +102,7 @@ For more information about [[= product_name_base =]] configuration, see [Configu You can extend the external URL address validation with a custom protocol. To do this, you must provide a service that implements the `Ibexa\Bundle\Core\URLChecker\URLHandlerInterface` interface: s -```php +```php skip-validation setContext($new_context); diff --git a/docs/infrastructure_and_maintenance/cache/http_cache/content_aware_cache.md b/docs/infrastructure_and_maintenance/cache/http_cache/content_aware_cache.md index 6e93ca73d3..29744eef90 100644 --- a/docs/infrastructure_and_maintenance/cache/http_cache/content_aware_cache.md +++ b/docs/infrastructure_and_maintenance/cache/http_cache/content_aware_cache.md @@ -171,7 +171,7 @@ Examples for tagging everything needed for content using the autowireable [`Resp Examples for adding specific content tags using the autowireable `ContentTagInterface`: -``` php +``` php skip-validation /** @var \Ibexa\Contracts\HttpCache\Handler\ContentTagInterface $tagHandler */ // Example for tagging everything needed for Content: @@ -191,7 +191,7 @@ In PHP, FOSHttpCache exposes the `fos_http_cache.http.symfony_response_tagger` s The following example adds minimal tags when ID 33 and 34 are rendered in ESI, but parent response needs these tags to get refreshed if they're deleted: -``` php +``` php skip-validation /** @var \FOS\HttpCacheBundle\Http\SymfonyResponseTagger $responseTagger */ $responseTagger->addTags([ContentTagInterface::RELATION_PREFIX . '33', ContentTagInterface::RELATION_PREFIX . '34']); ``` @@ -203,7 +203,7 @@ See [Tagging from code](https://foshttpcachebundle.readthedocs.io/en/latest/feat For custom or built-in controllers (for example, REST) that still use `X-Location-Id`, `XLocationIdResponseSubscriber` handles translating this header to tags. It supports singular and comma-separated location ID value(s): -```php +```php skip-validation /** @var \Symfony\Component\HttpFoundation\Response $response */ $response->headers->set('X-Location-Id', 123); @@ -323,7 +323,7 @@ In other words, HTTP Cache for `[Parent1]`, children of `[Parent1]` ( if any ), While the system purges tags whenever API is used to change data, you may need to purge directly from code. For that you can use the built-in purge client: -```php +```php skip-validation /** @var \Ibexa\Contracts\HttpCache\PurgeClient\PurgeClientInterface $purgeClient */ // Example for purging by Location ID: diff --git a/docs/infrastructure_and_maintenance/cache/http_cache/context_aware_cache.md b/docs/infrastructure_and_maintenance/cache/http_cache/context_aware_cache.md index 9d299b4f34..27078d0313 100644 --- a/docs/infrastructure_and_maintenance/cache/http_cache/context_aware_cache.md +++ b/docs/infrastructure_and_maintenance/cache/http_cache/context_aware_cache.md @@ -91,7 +91,7 @@ This a low effort solution, and can be enough for one fragment that is reused ac Example: -```php +```php skip-validation // Inside a custom controller action, or even a Content View controller $response->setVary('Cookie'); ``` @@ -139,7 +139,7 @@ To avoid overloading any application code, take advantage of Symfony's event sys 1\. Add a [Response event (`kernel.response`)]([[= symfony_doc =]]/reference/events.html#kernel-response) [listener or subscriber]([[= symfony_doc =]]/event_dispatcher.html) to add your own hash to `/_fos_user_context_hash`: -```php +```php skip-validation public function addPreferenceHash(FilterResponseEvent $event) { $response = $event->getResponse(); @@ -186,7 +186,7 @@ public function addPreferenceHash(FilterResponseEvent $event) 3\. Add `Vary` in your custom controller or content view controller: -```php +```php skip-validation $response->setVary('X-User-Preference-Hash'); // If you _also_ need to vary on [[= product_name =]] permissions, instead use: diff --git a/docs/infrastructure_and_maintenance/cache/http_cache/reverse_proxy.md b/docs/infrastructure_and_maintenance/cache/http_cache/reverse_proxy.md index 3cb48b9002..2622657bd0 100644 --- a/docs/infrastructure_and_maintenance/cache/http_cache/reverse_proxy.md +++ b/docs/infrastructure_and_maintenance/cache/http_cache/reverse_proxy.md @@ -90,7 +90,7 @@ framework: On Upsun, Varnish doesn't have a static IP, like with [AWS LB]([[= symfony_doc =]]/deployment/proxies.html#but-what-if-the-ip-of-my-reverse-proxy-changes-constantly). For this reason, the `TRUSTED_PROXIES` env variable supports being set to value `REMOTE_ADDR`, which is equal to: - ```php + ```php skip-validation Request::setTrustedProxies([$request->server->get('REMOTE_ADDR')], Request::HEADER_X_FORWARDED_ALL); ``` diff --git a/docs/infrastructure_and_maintenance/cache/persistence_cache.md b/docs/infrastructure_and_maintenance/cache/persistence_cache.md index 4b34d52a2d..28024d1e4d 100644 --- a/docs/infrastructure_and_maintenance/cache/persistence_cache.md +++ b/docs/infrastructure_and_maintenance/cache/persistence_cache.md @@ -248,7 +248,7 @@ This service is an instance of `Symfony\Component\Cache\Adapter\TagAwareAdapterI Like any other service, you can also get the cache service with the [service container](php_api.md#service-container) like so: -``` php +``` php skip-validation // Getting the cache service in PHP /** @var \Symfony\Component\Cache\Adapter\TagAwareAdapterInterface */ @@ -259,7 +259,7 @@ $pool = $container->get('ibexa.cache_pool'); Example usage of the cache service: -``` php +``` php skip-validation // Example $cacheItem = $pool->getItem("myApp-object-${id}"); if ($cacheItem->isHit()) { @@ -280,7 +280,7 @@ For more info on usage, see [Symfony Cache's documentation]([[= symfony_doc =]]/ Persistence cache prefixes it's cache using "ibx-". Clearing persistence cache can thus be done in the following ways: -``` php +``` php skip-validation // To clear all cache (not recommended without a good reason) $pool->clear(); diff --git a/docs/multisite/languages/automated_translations.md b/docs/multisite/languages/automated_translations.md index 5bd9ee10d8..245b0caf17 100644 --- a/docs/multisite/languages/automated_translations.md +++ b/docs/multisite/languages/automated_translations.md @@ -34,7 +34,7 @@ composer require ibexa/automated-translation Symfony Flex installs and activates the package. However, you must modify the `config/bundles.php` file to change the bundle loading order so that `IbexaAutomatedTranslationBundle` is loaded before `IbexaAdminUiBundle`: - ```php + ```php skip-validation ['all' => true], ``` diff --git a/docs/permissions/custom_policies.md b/docs/permissions/custom_policies.md index 27df7b67c5..55064d1eaf 100644 --- a/docs/permissions/custom_policies.md +++ b/docs/permissions/custom_policies.md @@ -20,7 +20,7 @@ First level key is the module name which is limited to characters within the set Function value is an array of available limitations, identified by the alias declared in `LimitationType` service tag. If no limitation is provided, value can be `null` or an empty array. -``` php +``` php skip-validation [ "content" => [ "read" => ["Class", "ParentClass", "Node", "Language"], @@ -38,7 +38,7 @@ Name provided in the hash for each limitation is the same value set in the `alia For example: -``` php +``` php skip-validation isGranted( new Attribute('section', 'assign', ['valueObject' => $contentInfo, 'targets' => [$section]]) ); @@ -79,6 +79,6 @@ checks the `content/edit` permission for the provided content item at the provid To block access to a specific action of the controller, add the following to the action's definition: -``` php +``` php skip-validation $this->denyAccessUnlessGranted(new Attribute('state', 'administrate')); ``` diff --git a/docs/personalization/enable_personalization.md b/docs/personalization/enable_personalization.md index 7d3d2b4f17..5c66279b2c 100644 --- a/docs/personalization/enable_personalization.md +++ b/docs/personalization/enable_personalization.md @@ -491,7 +491,7 @@ You can retrieve data returned from the Personalization server and modify it bef To modify recommendation data, subscribe to `RecommendationResponseEvent`. See [`Event/Subscriber/RecommendationEventSubscriber.php`](https://github.com/ibexa/personalization-client/blob/main/src/lib/Event/Subscriber/RecommendationEventSubscriber.php) for an example: -``` php +``` php skip-validation public static function getSubscribedEvents(): array { return [ diff --git a/docs/personalization/integrate_recommendation_service.md b/docs/personalization/integrate_recommendation_service.md index a2049f526c..e42d07ecdf 100644 --- a/docs/personalization/integrate_recommendation_service.md +++ b/docs/personalization/integrate_recommendation_service.md @@ -34,7 +34,7 @@ The following examples show how you can integrate a CLICK event: PHP: -``` php +``` php skip-validation $mandator_id = '00000'; $content_type_id = '1'; $product_id = '123'; @@ -57,7 +57,7 @@ ycimg.src=url; A similar tracking image can be placed on a confirmation page that ends the payment process. -``` php +``` php skip-validation $server = '//event.perso.ibexa.co'; foreach ($just_bought_products as $product_id) { $tracking = $server.'/api/'.$mandator_id.'/buy/'.urlencode(user_id()).$content_type_id.$product_id; @@ -122,7 +122,7 @@ A response with two recommendations resembles the following object: You can use the following code to make requests and parse results: -``` php +``` php skip-validation $mandator_id = '00000'; $license_key = '67890-1234-5678-90123-4567'; $server = "https://reco.perso.ibexa.co"; diff --git a/docs/product_catalog/create_custom_name_schema_strategy.md b/docs/product_catalog/create_custom_name_schema_strategy.md index 3b03f3b54c..4c5bffa5ef 100644 --- a/docs/product_catalog/create_custom_name_schema_strategy.md +++ b/docs/product_catalog/create_custom_name_schema_strategy.md @@ -25,4 +25,4 @@ Next, you need to register the strategy in the dependency injection container: [[= include_file('code_samples/catalog/percent_name_schema_strategy/src/bundle/Resources/config/services/name_schema.yaml') =]] ``` -This ensures that the custom name schema strategy is available for use in generating URL aliases based on attribute values. \ No newline at end of file +This ensures that the custom name schema strategy is available for use in generating URL aliases based on attribute values. diff --git a/docs/release_notes/ez_platform_v2.4.md b/docs/release_notes/ez_platform_v2.4.md index 16d92cbdb2..4fb51d888b 100644 --- a/docs/release_notes/ez_platform_v2.4.md +++ b/docs/release_notes/ez_platform_v2.4.md @@ -182,7 +182,7 @@ The biggest benefit of this feature is saving load time on complex landing pages 1\. Register `LexikJWTAuthenticationBundle` bundle in `/app/AppKernel.php` - ``` php + ``` php skip-validation public function registerBundles() { $bundles = array( diff --git a/docs/release_notes/ez_platform_v3.0_deprecations.md b/docs/release_notes/ez_platform_v3.0_deprecations.md index a53c0491b1..630820ee3e 100644 --- a/docs/release_notes/ez_platform_v3.0_deprecations.md +++ b/docs/release_notes/ez_platform_v3.0_deprecations.md @@ -772,7 +772,7 @@ All classes and interfaces from `eZ\Publish\Core\Persistence\Database` and `eZ\P The signature of the `\eZ\Publish\Core\Persistence\Legacy\URL\Query\CriterionHandler::handle` contract now accepts `\Doctrine\DBAL\Query\QueryBuilder` instead of `\eZ\Publish\Core\Persistence\Database\SelectQuery` and has the following form: -``` php +``` php skip-validation use \Doctrine\DBAL\Query\QueryBuilder; use \eZ\Publish\Core\Persistence\Legacy\URL\Query\CriteriaConverter; use \eZ\Publish\API\Repository\Values\URL\Query\Criterion; diff --git a/docs/release_notes/ibexa_dxp_v4.6.md b/docs/release_notes/ibexa_dxp_v4.6.md index 46c05487bc..f04e188ced 100644 --- a/docs/release_notes/ibexa_dxp_v4.6.md +++ b/docs/release_notes/ibexa_dxp_v4.6.md @@ -1640,7 +1640,7 @@ Endpoints that allow you to manage prices in your platform with REST API: A signature for the `\Ibexa\Contracts\Rest\Output\Generator::startValueElement` method has been updated to the following: -```php +```php skip-validation /** * @phpstan-param scalar $value * @phpstan-param array $attributes diff --git a/docs/resources/contributing/package_structure.md b/docs/resources/contributing/package_structure.md index 05330652da..471b36ed4d 100644 --- a/docs/resources/contributing/package_structure.md +++ b/docs/resources/contributing/package_structure.md @@ -17,17 +17,17 @@ The following conventions apply to contributions to [[= product_name_base =]] co Define [[= product_name =]] core PHP code in a namespace with the following prefix: -```php +```php skip-validation namespace Ibexa; ``` A package which groups some DXP features can use an additional prefix, for example: -```php +```php skip-validation namespace Ibexa\Commerce; ``` -```php +```php skip-validation namespace Ibexa\Personalization; ``` @@ -55,11 +55,11 @@ The `src/lib` directory and its corresponding `Ibexa\` namespace ar Examples: -```php +```php skip-validation namespace Ibexa\Search; ``` -```php +```php skip-validation namespace Ibexa\Commerce\Shop; ``` @@ -67,7 +67,7 @@ namespace Ibexa\Commerce\Shop; The bundle class definition in the `src/bundle` directory must be: -```php +```php skip-validation namespace Ibexa\Bundle\; class Ibexa[ProductGroup]Bundle // ... @@ -76,13 +76,13 @@ class Ibexa[ProductGroup]Bundle // ... Examples: -```php +```php skip-validation namespace Ibexa\Bundle\Search; class IbexaSearchBundle // ... ``` -```php +```php skip-validation namespace Ibexa\Bundle\Commerce\Shop; class IbexaCommerceShopBundle // ... @@ -92,21 +92,21 @@ class IbexaCommerceShopBundle // ... A package may introduce a namespace for contracts, to be consumed by first and third party packages and projects, which must be prefixed as: -```php +```php skip-validation namespace Ibexa\Contracts; ``` Examples: -```php +```php skip-validation namespace Ibexa\Contracts\Kernel; ``` -```php +```php skip-validation namespace Ibexa\Contracts\SiteFactory; ``` -```php +```php skip-validation namespace Ibexa\Contracts\Commerce\Shop; ``` diff --git a/docs/search/activity_log_search_reference/action_criterion.md b/docs/search/activity_log_search_reference/action_criterion.md index b89e51d6eb..e6c9f3ea2d 100644 --- a/docs/search/activity_log_search_reference/action_criterion.md +++ b/docs/search/activity_log_search_reference/action_criterion.md @@ -10,7 +10,7 @@ A set of built-in names is available as `ActivityLogServiceInterface`'s `ACTION_ ## Example -```php +```php skip-validation $query = new ActivityLog\Query([ new ActivityLog\Criterion\ActionCriterion([ ActivityLog\ActivityLogServiceInterface::ACTION_DELETE, diff --git a/docs/search/activity_log_search_reference/logged_at_criterion.md b/docs/search/activity_log_search_reference/logged_at_criterion.md index b48457b347..e4abdd6a7f 100644 --- a/docs/search/activity_log_search_reference/logged_at_criterion.md +++ b/docs/search/activity_log_search_reference/logged_at_criterion.md @@ -20,7 +20,7 @@ The `LoggedAtCriterion` Activity Log Criterion matches activity log group that h The following example is to match all activity log groups that aren't older than a day: -```php +```php skip-validation $query = new ActivityLog\Query([ new ActivityLog\Criterion\LoggedAtCriterion(new \DateTime('- 1 day'), ActivityLog\Criterion\LoggedAtCriterion::GTE), ]); diff --git a/docs/search/activity_log_search_reference/object_criterion.md b/docs/search/activity_log_search_reference/object_criterion.md index 7be18ad3c5..c7afba74e7 100644 --- a/docs/search/activity_log_search_reference/object_criterion.md +++ b/docs/search/activity_log_search_reference/object_criterion.md @@ -9,13 +9,13 @@ The `ObjectCriterion` Activity Log Criterion matches log group with a log entry ## Examples -```php +```php skip-validation $query = new ActivityLog\Query([ new ActivityLog\Criterion\ObjectCriterion(Ibexa\Contracts\Core\Repository\Values\Content\Content::class), ]); ``` -```php +```php skip-validation $query = new ActivityLog\Query([ new ActivityLog\Criterion\ObjectCriterion(Ibexa\Contracts\ProductCatalog\Values\ProductVariantInterface::class, [123, 234, 345]), ]); diff --git a/docs/search/activity_log_search_reference/object_name_criterion.md b/docs/search/activity_log_search_reference/object_name_criterion.md index 48ad0b1248..f3572a2d39 100644 --- a/docs/search/activity_log_search_reference/object_name_criterion.md +++ b/docs/search/activity_log_search_reference/object_name_criterion.md @@ -13,7 +13,7 @@ The `ObjectNameCriterion` Activity Log Criterion matches log groups that have a ## Example -```php +```php skip-validation $query = new ActivityLog\Query([ new ActivityLog\Criterion\ObjectNameCriterion('Ibexa', ActivityLog\Criterion\ObjectNameCriterion::OPERATOR_CONTAINS), ]); diff --git a/docs/search/activity_log_search_reference/user_criterion.md b/docs/search/activity_log_search_reference/user_criterion.md index def4663f95..153427780c 100644 --- a/docs/search/activity_log_search_reference/user_criterion.md +++ b/docs/search/activity_log_search_reference/user_criterion.md @@ -8,7 +8,7 @@ The `UserCriterion` Activity Log Criterion matches log groups that have an activ ## Example -```php +```php skip-validation $query = new ActivityLog\Query([ new ActivityLog\Criterion\UserCriterion([10, 14]), ]); diff --git a/docs/search/aggregation_reference/authorterm_aggregation.md b/docs/search/aggregation_reference/authorterm_aggregation.md index 80d155c488..e333b17b0c 100644 --- a/docs/search/aggregation_reference/authorterm_aggregation.md +++ b/docs/search/aggregation_reference/authorterm_aggregation.md @@ -12,7 +12,7 @@ The field-based [AuthorTermAggregation](/api/php_api/php_api_reference/classes/I ## Example -``` php +``` php skip-validation $query = new Query(); $query->aggregations[] = new Aggregation\Field\AuthorTermAggregation('author', 'article', 'authors'); ``` diff --git a/docs/search/aggregation_reference/basepricestats_aggregation.md b/docs/search/aggregation_reference/basepricestats_aggregation.md index 74f3bd6a77..26e0cf24e7 100644 --- a/docs/search/aggregation_reference/basepricestats_aggregation.md +++ b/docs/search/aggregation_reference/basepricestats_aggregation.md @@ -20,9 +20,9 @@ You can use the provided getters to access the values: ## Example -``` php +``` php skip-validation $query = new ProductQuery(); $query->setAggregations([ new BasePriceStatsAggregation('base_price_stats_aggregation', $currency), ]); -``` \ No newline at end of file +``` diff --git a/docs/search/aggregation_reference/checkboxterm_aggregation.md b/docs/search/aggregation_reference/checkboxterm_aggregation.md index 7a595366ff..56c219cbcf 100644 --- a/docs/search/aggregation_reference/checkboxterm_aggregation.md +++ b/docs/search/aggregation_reference/checkboxterm_aggregation.md @@ -12,7 +12,7 @@ The field-based [CheckboxTermAggregation](/api/php_api/php_api_reference/classes ## Example -``` php +``` php skip-validation $query = new Query(); $query->aggregations[] = new Aggregation\Field\CheckboxTermAggregation('checkbox', 'article', 'enable_comments'); ``` diff --git a/docs/search/aggregation_reference/contenttypegroupterm_aggregation.md b/docs/search/aggregation_reference/contenttypegroupterm_aggregation.md index 1d42dced95..a16d4f3ae9 100644 --- a/docs/search/aggregation_reference/contenttypegroupterm_aggregation.md +++ b/docs/search/aggregation_reference/contenttypegroupterm_aggregation.md @@ -12,7 +12,7 @@ The [ContentTypeGroupTermAggregation](/api/php_api/php_api_reference/classes/Ibe ## Example -``` php +``` php skip-validation $query = new Query(); $query->aggregations[] = new Aggregation\ContentTypeGroupTermAggregation('content_type_group'); ``` diff --git a/docs/search/aggregation_reference/contenttypeterm_aggregation.md b/docs/search/aggregation_reference/contenttypeterm_aggregation.md index 1d3d242f26..69b0e5f4a6 100644 --- a/docs/search/aggregation_reference/contenttypeterm_aggregation.md +++ b/docs/search/aggregation_reference/contenttypeterm_aggregation.md @@ -12,7 +12,7 @@ The [ContentTypeTermAggregation](/api/php_api/php_api_reference/classes/Ibexa-Co ## Example -``` php +``` php skip-validation $query = new Query(); $query->aggregations[] = new Aggregation\ContentTypeTermAggregation('content_type'); ``` diff --git a/docs/search/aggregation_reference/countryterm_aggregation.md b/docs/search/aggregation_reference/countryterm_aggregation.md index 6bc909190e..9e4fdf6be0 100644 --- a/docs/search/aggregation_reference/countryterm_aggregation.md +++ b/docs/search/aggregation_reference/countryterm_aggregation.md @@ -12,7 +12,7 @@ The field-based [CountryTermAggregation](/api/php_api/php_api_reference/classes/ ## Example -``` php +``` php skip-validation $query = new Query(); $query->aggregations[] = new Aggregation\Field\CountryTermAggregation('country', 'article', 'country'); ``` diff --git a/docs/search/aggregation_reference/custompricestats_aggregation.md b/docs/search/aggregation_reference/custompricestats_aggregation.md index 08413b7888..7d9a76cfc0 100644 --- a/docs/search/aggregation_reference/custompricestats_aggregation.md +++ b/docs/search/aggregation_reference/custompricestats_aggregation.md @@ -20,9 +20,9 @@ The CustomPriceStatsAggregation aggregates search results by the value of the cu ## Example -``` php +``` php skip-validation $query = new ProductQuery(); $query->setAggregations([ new CustomPriceStatsAggregation('custom_price_stats_aggregation', $currency, $customerGroup), ]); -``` \ No newline at end of file +``` diff --git a/docs/search/aggregation_reference/datemetadatarange_aggregation.md b/docs/search/aggregation_reference/datemetadatarange_aggregation.md index fbd1e431fb..7293c5989f 100644 --- a/docs/search/aggregation_reference/datemetadatarange_aggregation.md +++ b/docs/search/aggregation_reference/datemetadatarange_aggregation.md @@ -14,7 +14,7 @@ The [DateMetadataRangeAggregation](/api/php_api/php_api_reference/classes/Ibexa- ## Example -``` php +``` php skip-validation $query = new Query(); $query->aggregations[] = new Aggregation\DateMetadataRangeAggregation('date_metadata', Aggregation\DateMetadataRangeAggregation::PUBLISHED, [ diff --git a/docs/search/aggregation_reference/daterange_aggregation.md b/docs/search/aggregation_reference/daterange_aggregation.md index 518cc39b77..f2324b0064 100644 --- a/docs/search/aggregation_reference/daterange_aggregation.md +++ b/docs/search/aggregation_reference/daterange_aggregation.md @@ -13,7 +13,7 @@ The field-based [DateRangeAggregation](/api/php_api/php_api_reference/classes/Ib ## Example -``` php +``` php skip-validation $query = new Query(); $query->aggregations[] = new Aggregation\Field\DateRangeAggregation('date', 'event', 'event_date', [ diff --git a/docs/search/aggregation_reference/datetimerange_aggregation.md b/docs/search/aggregation_reference/datetimerange_aggregation.md index 84b6c7fe62..7c1538c932 100644 --- a/docs/search/aggregation_reference/datetimerange_aggregation.md +++ b/docs/search/aggregation_reference/datetimerange_aggregation.md @@ -13,7 +13,7 @@ The field-based [DateTimeRangeAggregation](/api/php_api/php_api_reference/classe ## Example -``` php +``` php skip-validation $query = new Query(); $query->aggregations[] = new Aggregation\Field\DateTimeRangeAggregation('date', 'event', 'event_date', [ diff --git a/docs/search/aggregation_reference/floatrange_aggregation.md b/docs/search/aggregation_reference/floatrange_aggregation.md index d94c1dedc9..aa23ce7a70 100644 --- a/docs/search/aggregation_reference/floatrange_aggregation.md +++ b/docs/search/aggregation_reference/floatrange_aggregation.md @@ -13,7 +13,7 @@ The field-based [FloatRangeAggregation](/api/php_api/php_api_reference/classes/I ## Example -``` php +``` php skip-validation $query = new Query(); $query->aggregations[] = new Aggregation\Field\FloatRangeAggregation('float', 'product', 'weight', [ diff --git a/docs/search/aggregation_reference/floatstats_aggregation.md b/docs/search/aggregation_reference/floatstats_aggregation.md index 5d2be9bb13..14999c3f77 100644 --- a/docs/search/aggregation_reference/floatstats_aggregation.md +++ b/docs/search/aggregation_reference/floatstats_aggregation.md @@ -19,7 +19,7 @@ You can use the provided getters to access the values: ## Example -``` php +``` php skip-validation $query = new Query(); $query->aggregations[] = new Aggregation\Field\FloatStatsAggregation('float', 'product', 'weight'); ``` diff --git a/docs/search/aggregation_reference/integerrange_aggregation.md b/docs/search/aggregation_reference/integerrange_aggregation.md index 37c51b76a6..861cae2a45 100644 --- a/docs/search/aggregation_reference/integerrange_aggregation.md +++ b/docs/search/aggregation_reference/integerrange_aggregation.md @@ -13,7 +13,7 @@ The field-based [IntegerRangeAggregation](/api/php_api/php_api_reference/classes ## Example -``` php +``` php skip-validation $query = new Query(); $query->aggregations[] = new Aggregation\Field\IntegerRangeAggregation('integer', 'product', 'amount', [ diff --git a/docs/search/aggregation_reference/integerstats_aggregation.md b/docs/search/aggregation_reference/integerstats_aggregation.md index 13d65dcd3a..f097ba02a9 100644 --- a/docs/search/aggregation_reference/integerstats_aggregation.md +++ b/docs/search/aggregation_reference/integerstats_aggregation.md @@ -18,7 +18,7 @@ The field-based [IntegerStatsAggregation](/api/php_api/php_api_reference/classes ## Example -``` php +``` php skip-validation $query = new Query(); $query->aggregations[] = new Aggregation\Field\IntegerStatsAggregation('integer', 'product', 'amount'); ``` diff --git a/docs/search/aggregation_reference/keywordterm_aggregation.md b/docs/search/aggregation_reference/keywordterm_aggregation.md index e0eff92f43..c6ed20de6a 100644 --- a/docs/search/aggregation_reference/keywordterm_aggregation.md +++ b/docs/search/aggregation_reference/keywordterm_aggregation.md @@ -12,7 +12,7 @@ The field-based [KeywordTermAggregation](/api/php_api/php_api_reference/classes/ ## Example -``` php +``` php skip-validation $query = new Query(); $query->aggregations[] = new Aggregation\Field\KeywordTermAggregation('keyword', 'article', 'tags'); ``` diff --git a/docs/search/aggregation_reference/languageterm_aggregation.md b/docs/search/aggregation_reference/languageterm_aggregation.md index 6f5e6bd09f..964650a099 100644 --- a/docs/search/aggregation_reference/languageterm_aggregation.md +++ b/docs/search/aggregation_reference/languageterm_aggregation.md @@ -12,7 +12,7 @@ The [LanguageTermAggregation](/api/php_api/php_api_reference/classes/Ibexa-Contr ## Example -``` php +``` php skip-validation $query = new Query(); $query->aggregations[] = new Aggregation\LanguageTermAggregation('language'); ``` diff --git a/docs/search/aggregation_reference/locationchildrenterm_aggregation.md b/docs/search/aggregation_reference/locationchildrenterm_aggregation.md index b530e83ab2..2889936f9d 100644 --- a/docs/search/aggregation_reference/locationchildrenterm_aggregation.md +++ b/docs/search/aggregation_reference/locationchildrenterm_aggregation.md @@ -12,7 +12,7 @@ The [LocationChildrenTermAggregation](/api/php_api/php_api_reference/classes/Ibe ## Example -``` php +``` php skip-validation $query = new LocationQuery(); $query->aggregations[] = new Aggregation\Location\LocationChildrenTermAggregation('location_children'); ``` diff --git a/docs/search/aggregation_reference/objectstateterm_aggregation.md b/docs/search/aggregation_reference/objectstateterm_aggregation.md index 099df6822c..4984bb31ae 100644 --- a/docs/search/aggregation_reference/objectstateterm_aggregation.md +++ b/docs/search/aggregation_reference/objectstateterm_aggregation.md @@ -13,7 +13,7 @@ The [ObjectStateTermAggregation](/api/php_api/php_api_reference/classes/Ibexa-Co ## Example -``` php +``` php skip-validation $query = new Query(); $query->aggregations[] = new Aggregation\Location\ObjectStateTermAggregation('object_state', 'ibexa_lock'); ``` diff --git a/docs/search/aggregation_reference/product_attribute_aggregations.md b/docs/search/aggregation_reference/product_attribute_aggregations.md index d6a533713e..026f1d2f8a 100644 --- a/docs/search/aggregation_reference/product_attribute_aggregations.md +++ b/docs/search/aggregation_reference/product_attribute_aggregations.md @@ -27,14 +27,14 @@ Range aggregations (`ProductAttributeFloatRangeAggregation` and `ProductAttribut ## Example -``` php +``` php skip-validation $query = new ProductQuery(); $query->setAggregations([ new ProductAttributeSelectionAggregation('skin', 'skin_type'), ]); ``` -``` php +``` php skip-validation $query = new ProductQuery(); $query->setAggregations([ new ProductAttributeIntegerRangeAggregation('buttons', 'number_of_buttons', [ diff --git a/docs/search/aggregation_reference/productavailabilityterm_aggregation.md b/docs/search/aggregation_reference/productavailabilityterm_aggregation.md index 45058d73d6..1bcd89a9ed 100644 --- a/docs/search/aggregation_reference/productavailabilityterm_aggregation.md +++ b/docs/search/aggregation_reference/productavailabilityterm_aggregation.md @@ -12,7 +12,7 @@ The ProductAvailabilityTermAggregation aggregates search results by product avai ## Example -``` php +``` php skip-validation $query = new ProductQuery(); $query->setAggregations([ new ProductAvailabilityTermAggregation('product_availability'), diff --git a/docs/search/aggregation_reference/productpricerange_aggregation.md b/docs/search/aggregation_reference/productpricerange_aggregation.md index aa6774888c..486c151488 100644 --- a/docs/search/aggregation_reference/productpricerange_aggregation.md +++ b/docs/search/aggregation_reference/productpricerange_aggregation.md @@ -14,7 +14,7 @@ The ProductPriceRangeAggregation aggregates search results by the value of the p ## Example -``` php +``` php skip-validation $query = new ProductQuery(); $query->setAggregations([ new ProductPriceRangeAggregation('price', 'PLN', [ diff --git a/docs/search/aggregation_reference/productstockrange_aggregation.md b/docs/search/aggregation_reference/productstockrange_aggregation.md index 0b29292bc6..05d34bda73 100644 --- a/docs/search/aggregation_reference/productstockrange_aggregation.md +++ b/docs/search/aggregation_reference/productstockrange_aggregation.md @@ -13,7 +13,7 @@ The ProductStockRangeAggregation aggregates search results by products' numerica ## Example -``` php +``` php skip-validation $productQuery = new ProductQuery(); $productQuery->setAggregations([ new ProductStockRangeAggregation('stock', [ diff --git a/docs/search/aggregation_reference/producttypeterm_aggregation.md b/docs/search/aggregation_reference/producttypeterm_aggregation.md index aac92ab6d7..0bf040ab1e 100644 --- a/docs/search/aggregation_reference/producttypeterm_aggregation.md +++ b/docs/search/aggregation_reference/producttypeterm_aggregation.md @@ -12,7 +12,7 @@ The ProductTypeTermAggregation aggregates search results by the product type. ## Example -``` php +``` php skip-validation $query = new ProductQuery(); $query->setAggregations([ new ProductTypeTermAggregation('product_type'), diff --git a/docs/search/aggregation_reference/rawrange_aggregation.md b/docs/search/aggregation_reference/rawrange_aggregation.md index 98b7f9c156..a49c2653f5 100644 --- a/docs/search/aggregation_reference/rawrange_aggregation.md +++ b/docs/search/aggregation_reference/rawrange_aggregation.md @@ -21,7 +21,7 @@ The [RawRangeAggregation](/api/php_api/php_api_reference/classes/Ibexa-Contracts ## Example -``` php +``` php skip-validation $query = new LocationQuery(); $query->aggregations[] = new Aggregation\RawRangeAggregation('priority', 'priority_id', [ new Query\Aggregation\Range(1, 10), diff --git a/docs/search/aggregation_reference/rawstats_aggregation.md b/docs/search/aggregation_reference/rawstats_aggregation.md index fd8b51e0d9..900d6b15f2 100644 --- a/docs/search/aggregation_reference/rawstats_aggregation.md +++ b/docs/search/aggregation_reference/rawstats_aggregation.md @@ -27,7 +27,7 @@ You can use the provided getters to access the values: ## Example -``` php +``` php skip-validation $query = new Query(); $query->aggregations[] = new Aggregation\RawStatsAggregation('location_depth', 'depth_i'); ``` diff --git a/docs/search/aggregation_reference/rawterm_aggregation.md b/docs/search/aggregation_reference/rawterm_aggregation.md index 94d629b520..6a909fe85c 100644 --- a/docs/search/aggregation_reference/rawterm_aggregation.md +++ b/docs/search/aggregation_reference/rawterm_aggregation.md @@ -20,7 +20,7 @@ The [RawTermAggregation](/api/php_api/php_api_reference/classes/Ibexa-Contracts- ## Example -``` php +``` php skip-validation $query = new Query(); $query->aggregations[] = new Aggregation\RawTermAggregation('content_per_content_type', 'content_type_id_id'); ``` diff --git a/docs/search/aggregation_reference/sectionterm_aggregation.md b/docs/search/aggregation_reference/sectionterm_aggregation.md index 51980b5f76..99bf45cb0b 100644 --- a/docs/search/aggregation_reference/sectionterm_aggregation.md +++ b/docs/search/aggregation_reference/sectionterm_aggregation.md @@ -12,7 +12,7 @@ The [SectionTermAggregation](/api/php_api/php_api_reference/classes/Ibexa-Contra ## Example -``` php +``` php skip-validation $query = new Query(); $query->aggregations[] = new Aggregation\SectionTermAggregation('section'); ``` diff --git a/docs/search/aggregation_reference/selectionterm_aggregation.md b/docs/search/aggregation_reference/selectionterm_aggregation.md index d6b468f228..4130322e6b 100644 --- a/docs/search/aggregation_reference/selectionterm_aggregation.md +++ b/docs/search/aggregation_reference/selectionterm_aggregation.md @@ -12,7 +12,7 @@ The field-based [SelectionTermAggregation](/api/php_api/php_api_reference/classe ## Example -``` php +``` php skip-validation $query = new Query(); $query->aggregations[] = new Aggregation\Field\SelectionTermAggregation('selection', 'article', 'select'); ``` diff --git a/docs/search/aggregation_reference/subtreeterm_aggregation.md b/docs/search/aggregation_reference/subtreeterm_aggregation.md index 780140492b..afdd4e1eae 100644 --- a/docs/search/aggregation_reference/subtreeterm_aggregation.md +++ b/docs/search/aggregation_reference/subtreeterm_aggregation.md @@ -13,7 +13,7 @@ The [SubtreeTermAggregation](/api/php_api/php_api_reference/classes/Ibexa-Contra ## Example -``` php +``` php skip-validation $query = new Query(); $query->aggregations[] = new Aggregation\Location\SubtreeTermAggregation('pathstring', '/1/2/'); ``` diff --git a/docs/search/aggregation_reference/taxonomyentryid_aggregation.md b/docs/search/aggregation_reference/taxonomyentryid_aggregation.md index cff1e2b455..5ab2d866b2 100644 --- a/docs/search/aggregation_reference/taxonomyentryid_aggregation.md +++ b/docs/search/aggregation_reference/taxonomyentryid_aggregation.md @@ -13,12 +13,12 @@ The `TaxonomyEntryIdAggregation` aggregates search results by the content item's ## Example -``` php +``` php skip-validation $query = new Query(); $query->aggregations[] = new Aggregation\TaxonomyEntryIdAggregation('taxonomy', 'tags'); ``` -``` php +``` php skip-validation $query = new ProductQuery(); $query->aggregations[] = new Aggregation\TaxonomyEntryIdAggregation('categories', 'product_categories'); ``` diff --git a/docs/search/aggregation_reference/timerange_aggregation.md b/docs/search/aggregation_reference/timerange_aggregation.md index c38920833b..8b92128c11 100644 --- a/docs/search/aggregation_reference/timerange_aggregation.md +++ b/docs/search/aggregation_reference/timerange_aggregation.md @@ -13,7 +13,7 @@ The field-based [TimeRangeAggregation](/api/php_api/php_api_reference/classes/Ib ## Example -``` php +``` php skip-validation $query = new Query(); $query->aggregations[] = new Aggregation\Field\TimeRangeAggregation('date', 'event', 'event_time', [ diff --git a/docs/search/aggregation_reference/usermetadataterm_aggregation.md b/docs/search/aggregation_reference/usermetadataterm_aggregation.md index 275e2742e1..c9ba6902f0 100644 --- a/docs/search/aggregation_reference/usermetadataterm_aggregation.md +++ b/docs/search/aggregation_reference/usermetadataterm_aggregation.md @@ -12,7 +12,7 @@ The [UserMetadataTermAggregation](/api/php_api/php_api_reference/classes/Ibexa-C ## Example -``` php +``` php skip-validation $query = new Query(); $query->aggregations[] = new Aggregation\UserMetadataTermAggregation('user_metadata'); ``` diff --git a/docs/search/aggregation_reference/visibilityterm_aggregation.md b/docs/search/aggregation_reference/visibilityterm_aggregation.md index 780fa57d48..52ddbf4652 100644 --- a/docs/search/aggregation_reference/visibilityterm_aggregation.md +++ b/docs/search/aggregation_reference/visibilityterm_aggregation.md @@ -12,7 +12,7 @@ The [VisibilityTermAggregation](/api/php_api/php_api_reference/classes/Ibexa-Con ## Example -``` php +``` php skip-validation $query = new Query(); $query->aggregations[] = new Aggregation\VisibilityTermAggregation('visibility'); ``` diff --git a/docs/search/criteria_reference/ancestor_criterion.md b/docs/search/criteria_reference/ancestor_criterion.md index d0853413a0..3f2aa6cd23 100644 --- a/docs/search/criteria_reference/ancestor_criterion.md +++ b/docs/search/criteria_reference/ancestor_criterion.md @@ -14,7 +14,7 @@ The [`Ancestor` Search Criterion](/api/php_api/php_api_reference/classes/Ibexa-C ### PHP -``` php +``` php skip-validation $query->query = new Criterion\Ancestor([$this->locationService->loadLocation(62)->pathString]); ``` @@ -44,7 +44,7 @@ $query->query = new Criterion\Ancestor([$this->locationService->loadLocation(62) You can use the Ancestor Search Criterion to create a list of breadcrumbs leading to the Location: -``` php hl_lines="2" +``` php skip-validation hl_lines="2" $query = new LocationQuery(); $query->query = new Criterion\Ancestor([$this->locationService->loadLocation($locationId)->pathString]); diff --git a/docs/search/criteria_reference/baseprice_criterion.md b/docs/search/criteria_reference/baseprice_criterion.md index bbc95e06cc..aec7326f49 100644 --- a/docs/search/criteria_reference/baseprice_criterion.md +++ b/docs/search/criteria_reference/baseprice_criterion.md @@ -19,7 +19,7 @@ The `BasePrice` Criterion isn't available in the Legacy Search engine. ### PHP -``` php +``` php skip-validation $query = new ProductQuery( null, new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\BasePrice( diff --git a/docs/search/criteria_reference/checkboxattribute_criterion.md b/docs/search/criteria_reference/checkboxattribute_criterion.md index eb72b6a723..4ee56a31ca 100644 --- a/docs/search/criteria_reference/checkboxattribute_criterion.md +++ b/docs/search/criteria_reference/checkboxattribute_criterion.md @@ -15,7 +15,7 @@ The `CheckboxAttribute` Search Criterion searches for products by the value of t ### PHP -``` php +``` php skip-validation $query = new ProductQuery( null, new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\CheckboxAttribute('automatic', true) diff --git a/docs/search/criteria_reference/colorattribute_criterion.md b/docs/search/criteria_reference/colorattribute_criterion.md index e196933a1f..8daca01c21 100644 --- a/docs/search/criteria_reference/colorattribute_criterion.md +++ b/docs/search/criteria_reference/colorattribute_criterion.md @@ -15,7 +15,7 @@ The `ColorAttribute` Search Criterion searches for products by the value of thei ### PHP -``` php +``` php skip-validation $query = new ProductQuery( null, new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\ColorAttribute('color', ['#FF0000']) @@ -50,4 +50,4 @@ $query = new ProductQuery( } } } - ``` \ No newline at end of file + ``` diff --git a/docs/search/criteria_reference/contentid_criterion.md b/docs/search/criteria_reference/contentid_criterion.md index c468ad0fed..888d8212d5 100644 --- a/docs/search/criteria_reference/contentid_criterion.md +++ b/docs/search/criteria_reference/contentid_criterion.md @@ -14,7 +14,7 @@ The [`ContentId` Search Criterion](/api/php_api/php_api_reference/classes/Ibexa- ### PHP -``` php +``` php skip-validation $query->query = new Criterion\ContentId([62, 64]); ``` diff --git a/docs/search/criteria_reference/contentname_criterion.md b/docs/search/criteria_reference/contentname_criterion.md index 0c57bf7023..717a84ed9c 100644 --- a/docs/search/criteria_reference/contentname_criterion.md +++ b/docs/search/criteria_reference/contentname_criterion.md @@ -14,7 +14,7 @@ The [`ContentName` Search Criterion](https://github.com/ibexa/core/blob/5.0/src/ ### PHP -``` php +``` php skip-validation $query->query = new Criterion\ContentName('*phone'); ``` diff --git a/docs/search/criteria_reference/contenttypegroupid_criterion.md b/docs/search/criteria_reference/contenttypegroupid_criterion.md index e8395aac51..84f704b760 100644 --- a/docs/search/criteria_reference/contenttypegroupid_criterion.md +++ b/docs/search/criteria_reference/contenttypegroupid_criterion.md @@ -14,7 +14,7 @@ The [`ContentTypeGroupId` Search Criterion](/api/php_api/php_api_reference/class ### PHP -``` php +``` php skip-validation $query->query = new Criterion\ContentTypeGroupId([1, 2]); ``` @@ -45,7 +45,7 @@ $query->query = new Criterion\ContentTypeGroupId([1, 2]); You can use the `ContentTypeGroupId` Criterion to query all Media content items (the default ID for the Media content type group is 3): -``` php hl_lines="1" +``` php skip-validation hl_lines="1" $query->query = new Criterion\ContentTypeGroupId([3]); $results = $this->searchService->findContent($query); diff --git a/docs/search/criteria_reference/contenttypeid_criterion.md b/docs/search/criteria_reference/contenttypeid_criterion.md index 2c8301358d..0820037f6a 100644 --- a/docs/search/criteria_reference/contenttypeid_criterion.md +++ b/docs/search/criteria_reference/contenttypeid_criterion.md @@ -14,7 +14,7 @@ The [`ContentTypeId` Search Criterion](/api/php_api/php_api_reference/classes/Ib ### PHP -``` php +``` php skip-validation $query->query = new Criterion\ContentTypeId([44]); ``` diff --git a/docs/search/criteria_reference/contenttypeidentifier_criterion.md b/docs/search/criteria_reference/contenttypeidentifier_criterion.md index 8cb8995a9e..104c9c7346 100644 --- a/docs/search/criteria_reference/contenttypeidentifier_criterion.md +++ b/docs/search/criteria_reference/contenttypeidentifier_criterion.md @@ -14,7 +14,7 @@ The [`ContentTypeIdentifier` Search Criterion](/api/php_api/php_api_reference/cl ### PHP -``` php +``` php skip-validation $query->query = new Criterion\ContentTypeIdentifier(['article', 'blog_post']); ``` diff --git a/docs/search/criteria_reference/createdat_criterion.md b/docs/search/criteria_reference/createdat_criterion.md index 06ae3046b0..cdadf5b736 100644 --- a/docs/search/criteria_reference/createdat_criterion.md +++ b/docs/search/criteria_reference/createdat_criterion.md @@ -15,7 +15,7 @@ The `CreatedAt` Search Criterion searches for products based on the date when th ### PHP -``` php +``` php skip-validation $criteria = new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\CreatedAt( new DateTime('2023-03-01'), \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\Operator::GTE, @@ -52,4 +52,4 @@ $productQuery = new ProductQuery(null, $criteria); } } } - ``` \ No newline at end of file + ``` diff --git a/docs/search/criteria_reference/createdatrange_criterion.md b/docs/search/criteria_reference/createdatrange_criterion.md index fe6de80520..d87f528c9a 100644 --- a/docs/search/criteria_reference/createdatrange_criterion.md +++ b/docs/search/criteria_reference/createdatrange_criterion.md @@ -15,7 +15,7 @@ The `CreatedAtRange` Search Criterion searches for products based on the date ra ### PHP -``` php +``` php skip-validation $criteria = new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\CreatedAtRange( new \DateTimeImmutable('2020-07-10T00:00:00+00:00'), new \DateTimeImmutable('2023-07-12T00:00:00+00:00') @@ -52,4 +52,4 @@ $productQuery = new ProductQuery(null, $criteria); } } } - ``` \ No newline at end of file + ``` diff --git a/docs/search/criteria_reference/currencycode_criterion.md b/docs/search/criteria_reference/currencycode_criterion.md index c98073e693..8c9d6fbf21 100644 --- a/docs/search/criteria_reference/currencycode_criterion.md +++ b/docs/search/criteria_reference/currencycode_criterion.md @@ -18,6 +18,6 @@ The `CurrencyCodeCriterion` Criterion isn't available in Solr or Elasticsearch e ### PHP -``` php +``` php skip-validation $query->query = new \Ibexa\Contracts\ProductCatalog\Values\Currency\Query\Criterion\CurrencyCodeCriterion('EUR'); ``` diff --git a/docs/search/criteria_reference/customergroupid_criterion.md b/docs/search/criteria_reference/customergroupid_criterion.md index 4a27b612c6..f3c183f7b7 100644 --- a/docs/search/criteria_reference/customergroupid_criterion.md +++ b/docs/search/criteria_reference/customergroupid_criterion.md @@ -14,6 +14,6 @@ The `CustomerGroupId` Search Criterion searches for content based on the ID of i ### PHP -``` php +``` php skip-validation $query->query = new Criterion\CustomerGroupId(1); ``` diff --git a/docs/search/criteria_reference/customprice_criterion.md b/docs/search/criteria_reference/customprice_criterion.md index b4752cf374..3ad7a2ee0c 100644 --- a/docs/search/criteria_reference/customprice_criterion.md +++ b/docs/search/criteria_reference/customprice_criterion.md @@ -21,7 +21,7 @@ The `CustomPrice` Criterion isn't available in the Legacy Search engine. ### PHP -``` php +``` php skip-validation $query = new ProductQuery( null, new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\CustomPrice( diff --git a/docs/search/criteria_reference/datemetadata_criterion.md b/docs/search/criteria_reference/datemetadata_criterion.md index 3c94a49b8a..458dd28d6c 100644 --- a/docs/search/criteria_reference/datemetadata_criterion.md +++ b/docs/search/criteria_reference/datemetadata_criterion.md @@ -16,7 +16,7 @@ The [`DateMetadata` Search Criterion](/api/php_api/php_api_reference/classes/Ibe ### PHP -``` php +``` php skip-validation $query->query = new Criterion\DateMetadata( Criterion\DateMetadata::CREATED, Criterion\Operator::BETWEEN, @@ -58,7 +58,7 @@ $query->query = new Criterion\DateMetadata( You can use the `DateMetadata` Criterion to search for blog posts that have been created within the last week: -``` php hl_lines="5" +``` php skip-validation hl_lines="5" $query = new LocationQuery; $date = strtotime("-1 week"); $query->query = new Criterion\LogicalAnd([ diff --git a/docs/search/criteria_reference/depth_criterion.md b/docs/search/criteria_reference/depth_criterion.md index 1389da5b42..094de545a4 100644 --- a/docs/search/criteria_reference/depth_criterion.md +++ b/docs/search/criteria_reference/depth_criterion.md @@ -23,6 +23,6 @@ The `value` argument requires: ### PHP -``` php +``` php skip-validation $query->query = new Criterion\Location\Depth(Criterion\Operator::LT, 3); ``` diff --git a/docs/search/criteria_reference/field_criterion.md b/docs/search/criteria_reference/field_criterion.md index e07057ebe3..4447a0e4ec 100644 --- a/docs/search/criteria_reference/field_criterion.md +++ b/docs/search/criteria_reference/field_criterion.md @@ -25,7 +25,7 @@ The `Field` Criterion isn't available in [Repository filtering](search_api.md#re ### PHP -``` php +``` php skip-validation $query->query = new Criterion\Field('name', Criterion\Operator::CONTAINS, 'Platform'); ``` @@ -65,7 +65,7 @@ $query->query = new Criterion\Field('name', Criterion\Operator::CONTAINS, 'Platf You can use the `Field` Criterion to search for articles that contain the word "featured": -``` php hl_lines="4" +``` php skip-validation hl_lines="4" $query = new LocationQuery(); $query->query = new Criterion\LogicalAnd([ new Criterion\ContentTypeIdentifier('article'), diff --git a/docs/search/criteria_reference/fieldrelation_criterion.md b/docs/search/criteria_reference/fieldrelation_criterion.md index cf2103597f..45a62b6444 100644 --- a/docs/search/criteria_reference/fieldrelation_criterion.md +++ b/docs/search/criteria_reference/fieldrelation_criterion.md @@ -22,6 +22,6 @@ The `FieldRelation` Criterion isn't available in [Repository filtering](search_a ### PHP -``` php +``` php skip-validation $query->query = new Criterion\FieldRelation('relations', Criterion\Operator::CONTAINS, [55, 63]); ``` diff --git a/docs/search/criteria_reference/floatattribute_criterion.md b/docs/search/criteria_reference/floatattribute_criterion.md index 37883cc172..4160fbc18a 100644 --- a/docs/search/criteria_reference/floatattribute_criterion.md +++ b/docs/search/criteria_reference/floatattribute_criterion.md @@ -15,7 +15,7 @@ The `FloatAttribute` Search Criterion searches for products by the value of thei ### PHP -``` php +``` php skip-validation $query = new ProductQuery( null, new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\FloatAttribute( @@ -53,4 +53,4 @@ $query = new ProductQuery( } } } - ``` \ No newline at end of file + ``` diff --git a/docs/search/criteria_reference/fulltext_criterion.md b/docs/search/criteria_reference/fulltext_criterion.md index 001d62c947..f742bcfbd6 100644 --- a/docs/search/criteria_reference/fulltext_criterion.md +++ b/docs/search/criteria_reference/fulltext_criterion.md @@ -39,19 +39,19 @@ The `FullText` Criterion isn't available in [Repository filtering](search_api.md ### PHP -``` php +``` php skip-validation $query->query = new Criterion\FullText('victory'); ``` Using double quotes to indicate a phrase: -``` php +``` php skip-validation $query->query = new Criterion\FullText('"world cup"'); ``` Using the AND operator and parenthesis to search for both words at the same time: -``` php +``` php skip-validation $query->query = new Criterion\FullText('baseball AND cup'); ``` @@ -81,7 +81,7 @@ $query->query = new Criterion\FullText('baseball AND cup'); Assume the following search query: -``` php +``` php skip-validation $query->query = new Criterion\FullText('(cup AND ba*ball) "breaking news"'); ``` diff --git a/docs/search/criteria_reference/image_criterion.md b/docs/search/criteria_reference/image_criterion.md index 2df2a0a3f7..e400769273 100644 --- a/docs/search/criteria_reference/image_criterion.md +++ b/docs/search/criteria_reference/image_criterion.md @@ -15,7 +15,7 @@ The `Image` Search Criterion searches for image by specified image attributes. ### PHP -``` php +``` php skip-validation $imageCriteriaData = [ 'mimeTypes' => [ 'image/png', diff --git a/docs/search/criteria_reference/imagedimensions_criterion.md b/docs/search/criteria_reference/imagedimensions_criterion.md index 4281fe6fb3..41f4b7318c 100644 --- a/docs/search/criteria_reference/imagedimensions_criterion.md +++ b/docs/search/criteria_reference/imagedimensions_criterion.md @@ -15,7 +15,7 @@ The `Dimensions` Search Criterion searches for image with specified dimensions. ### PHP -``` php +``` php skip-validation $imageCriteriaData = [ 'width' => [ 'min' => 100, // (default: 0, optional) diff --git a/docs/search/criteria_reference/imagefilesize_criterion.md b/docs/search/criteria_reference/imagefilesize_criterion.md index 04b85a8024..ce8cc0d519 100644 --- a/docs/search/criteria_reference/imagefilesize_criterion.md +++ b/docs/search/criteria_reference/imagefilesize_criterion.md @@ -16,7 +16,7 @@ The `FileSize` Search Criterion searches for image with specified size. ### PHP -``` php +``` php skip-validation $query->query = new Criterion\FileSize('image', 0, 1.5); ``` diff --git a/docs/search/criteria_reference/imageheight_criterion.md b/docs/search/criteria_reference/imageheight_criterion.md index 5f1ff96c79..b756b2000c 100644 --- a/docs/search/criteria_reference/imageheight_criterion.md +++ b/docs/search/criteria_reference/imageheight_criterion.md @@ -16,6 +16,6 @@ The `Height` Search Criterion searches for image with specified height. ### PHP -``` php +``` php skip-validation $query->query = new Criterion\Height('image', 0, 1500); ``` diff --git a/docs/search/criteria_reference/imagemimetype_criterion.md b/docs/search/criteria_reference/imagemimetype_criterion.md index f494232d6c..43b4238c55 100644 --- a/docs/search/criteria_reference/imagemimetype_criterion.md +++ b/docs/search/criteria_reference/imagemimetype_criterion.md @@ -15,13 +15,13 @@ The `MimeType` Search Criterion searches for image with specified mime type(s). ### PHP -``` php +``` php skip-validation $query->query = new Criterion\MimeType('image', 'image/jpeg'); ``` or -```php +```php skip-validation $mimeTypes = [ 'image/jpeg', 'image/png', diff --git a/docs/search/criteria_reference/imageorientation_criterion.md b/docs/search/criteria_reference/imageorientation_criterion.md index 1829d957a0..e76fd1b27e 100644 --- a/docs/search/criteria_reference/imageorientation_criterion.md +++ b/docs/search/criteria_reference/imageorientation_criterion.md @@ -16,7 +16,7 @@ Supported orientation values: landscape, portrait and square. ### PHP -``` php +``` php skip-validation $query->query = new Criterion\Orientation('image', 'landscape'); OR diff --git a/docs/search/criteria_reference/imagewidth_criterion.md b/docs/search/criteria_reference/imagewidth_criterion.md index 34ec3293c7..4d36b9cab8 100644 --- a/docs/search/criteria_reference/imagewidth_criterion.md +++ b/docs/search/criteria_reference/imagewidth_criterion.md @@ -16,6 +16,6 @@ The `Width` Search Criterion searches for image with specified width. ### PHP -``` php +``` php skip-validation $query->query = new Criterion\Width('image', 150, 1000); ``` diff --git a/docs/search/criteria_reference/integerattribute_criterion.md b/docs/search/criteria_reference/integerattribute_criterion.md index bb71bed820..a83db923b9 100644 --- a/docs/search/criteria_reference/integerattribute_criterion.md +++ b/docs/search/criteria_reference/integerattribute_criterion.md @@ -15,7 +15,7 @@ The `IntegerAttribute` Search Criterion searches for products by the value of th ### PHP -``` php +``` php skip-validation $query = new ProductQuery( null, new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\IntegerAttribute( @@ -53,4 +53,4 @@ $query = new ProductQuery( } } } - ``` \ No newline at end of file + ``` diff --git a/docs/search/criteria_reference/iscontainer_criterion.md b/docs/search/criteria_reference/iscontainer_criterion.md index b30f2d6313..c01ad46afa 100644 --- a/docs/search/criteria_reference/iscontainer_criterion.md +++ b/docs/search/criteria_reference/iscontainer_criterion.md @@ -15,7 +15,7 @@ The [`IsContainer` Search Criterion](/api/php_api/php_api_reference/classes/Ibex ### PHP -```php +```php skip-validation $query->query = new Criterion\IsContainer(); // Finds containers $query->query = new Criterion\IsContainer(false); // Finds non-containers ``` diff --git a/docs/search/criteria_reference/iscurrencyenabled_criterion.md b/docs/search/criteria_reference/iscurrencyenabled_criterion.md index 1985d5f8e2..df596347f3 100644 --- a/docs/search/criteria_reference/iscurrencyenabled_criterion.md +++ b/docs/search/criteria_reference/iscurrencyenabled_criterion.md @@ -19,6 +19,6 @@ The `IsCurrencyEnabledCriterion` Criterion isn't available in Solr or Elasticsea ### PHP -``` php +``` php skip-validation $query->query = new \Ibexa\Contracts\ProductCatalog\Values\Currency\Query\Criterion\IsCurrencyEnabledCriterion(); ``` diff --git a/docs/search/criteria_reference/isfieldempty_criterion.md b/docs/search/criteria_reference/isfieldempty_criterion.md index f8598b0397..13109ef426 100644 --- a/docs/search/criteria_reference/isfieldempty_criterion.md +++ b/docs/search/criteria_reference/isfieldempty_criterion.md @@ -25,7 +25,7 @@ For this use case, use [`TaxonomyNoEntries`](taxonomy_no_entries.md) instead. ### PHP -``` php +``` php skip-validation $query->query = new Criterion\IsFieldEmpty('title'); ``` @@ -33,7 +33,7 @@ $query->query = new Criterion\IsFieldEmpty('title'); You can use the `IsFieldEmpty` Criterion to search for articles that don't have an image: -``` php hl_lines="4" +``` php skip-validation hl_lines="4" $query = new LocationQuery; $query->query = new Criterion\LogicalAnd([ new Criterion\ContentTypeIdentifier('article'), diff --git a/docs/search/criteria_reference/ismainlocation_criterion.md b/docs/search/criteria_reference/ismainlocation_criterion.md index 8b0172d691..c169190415 100644 --- a/docs/search/criteria_reference/ismainlocation_criterion.md +++ b/docs/search/criteria_reference/ismainlocation_criterion.md @@ -17,6 +17,6 @@ representing whether to search for a main or not main location ### PHP -``` php +``` php skip-validation $query->query = new Criterion\Location\IsMainLocation(IsMainLocation::MAIN); ``` diff --git a/docs/search/criteria_reference/isproductbased_criterion.md b/docs/search/criteria_reference/isproductbased_criterion.md index 077682c18f..285020c423 100644 --- a/docs/search/criteria_reference/isproductbased_criterion.md +++ b/docs/search/criteria_reference/isproductbased_criterion.md @@ -10,6 +10,6 @@ The `IsProductBased` Search Criterion searches for content that plays the role o ### PHP -``` php +``` php skip-validation $query->query = new Ibexa\Contracts\ProductCatalog\Values\Content\Query\Criterion\IsProductBased(); ``` diff --git a/docs/search/criteria_reference/isuserbased_criterion.md b/docs/search/criteria_reference/isuserbased_criterion.md index c3302d0db0..5f6bc4af03 100644 --- a/docs/search/criteria_reference/isuserbased_criterion.md +++ b/docs/search/criteria_reference/isuserbased_criterion.md @@ -24,7 +24,7 @@ The `IsUserBased` Criterion isn't available in Solr or Elasticsearch engines. ### PHP -``` php +``` php skip-validation $query->query = new Criterion\IsUserBased(); ``` diff --git a/docs/search/criteria_reference/isuserenabled_criterion.md b/docs/search/criteria_reference/isuserenabled_criterion.md index d95e3b29ad..14404de5f2 100644 --- a/docs/search/criteria_reference/isuserenabled_criterion.md +++ b/docs/search/criteria_reference/isuserenabled_criterion.md @@ -15,7 +15,7 @@ The [`IsUserEnabled` Search Criterion](/api/php_api/php_api_reference/classes/Ib ### PHP -``` php +``` php skip-validation $query->query = new Criterion\IsUserEnabled(); ``` diff --git a/docs/search/criteria_reference/isvirtual_criterion.md b/docs/search/criteria_reference/isvirtual_criterion.md index 26be439adb..df5b112c36 100644 --- a/docs/search/criteria_reference/isvirtual_criterion.md +++ b/docs/search/criteria_reference/isvirtual_criterion.md @@ -14,7 +14,7 @@ The `IsVirtual` Search Criterion searches for virtual or physical products. ### PHP -``` php +``` php skip-validation $query = new ProductQuery( null, new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\IsVirtual(true) @@ -41,4 +41,4 @@ $query = new ProductQuery( "IsVirtualCriterion": true } } - ``` \ No newline at end of file + ``` diff --git a/docs/search/criteria_reference/languagecode_criterion.md b/docs/search/criteria_reference/languagecode_criterion.md index b4a977db2f..9ff7e70d84 100644 --- a/docs/search/criteria_reference/languagecode_criterion.md +++ b/docs/search/criteria_reference/languagecode_criterion.md @@ -15,7 +15,7 @@ The [`LanguageCode` Search Criterion](/api/php_api/php_api_reference/classes/Ibe ### PHP -``` php +``` php skip-validation $query->query = new Criterion\LanguageCode('ger-DE', false); ``` @@ -46,7 +46,7 @@ $query->query = new Criterion\LanguageCode('ger-DE', false); You can use the `LanguageCode` Criterion to search for articles that are lacking a translation into a specific language: -``` php hl_lines="5" +``` php skip-validation hl_lines="5" $query = new LocationQuery; $query->query = new Criterion\LogicalAnd([ new Criterion\ContentTypeIdentifier('article'), diff --git a/docs/search/criteria_reference/locationid_criterion.md b/docs/search/criteria_reference/locationid_criterion.md index 63169e9c71..c3a55de940 100644 --- a/docs/search/criteria_reference/locationid_criterion.md +++ b/docs/search/criteria_reference/locationid_criterion.md @@ -14,7 +14,7 @@ The [`LocationId` Search Criterion](/api/php_api/php_api_reference/classes/Ibexa ### PHP -``` php +``` php skip-validation $query->query = new Criterion\LocationId(62); ``` diff --git a/docs/search/criteria_reference/locationremoteid_criterion.md b/docs/search/criteria_reference/locationremoteid_criterion.md index d79bfd1aec..2dbb08f44b 100644 --- a/docs/search/criteria_reference/locationremoteid_criterion.md +++ b/docs/search/criteria_reference/locationremoteid_criterion.md @@ -14,7 +14,7 @@ The [`LocationRemoteId` Search Criterion](/api/php_api/php_api_reference/classes ### PHP -``` php +``` php skip-validation $query->query = new Criterion\LocationRemoteId(['4d1e5f216c0a7aaab7f005ffd4b6a8a8', 'b81ef3e62b514188bfddd2a80d447d34']); ``` diff --git a/docs/search/criteria_reference/logicaland_criterion.md b/docs/search/criteria_reference/logicaland_criterion.md index b4afdf3276..2843970759 100644 --- a/docs/search/criteria_reference/logicaland_criterion.md +++ b/docs/search/criteria_reference/logicaland_criterion.md @@ -16,7 +16,7 @@ When querying for [products](product_api.md), use [LogicalAnd](/api/php_api/php_ ### PHP -``` php +``` php skip-validation $query->query = new Criterion\LogicalAnd([ new Criterion\ContentTypeIdentifier('article'), new Criterion\SectionIdentifier(['sports', 'news']); diff --git a/docs/search/criteria_reference/logicalnot_criterion.md b/docs/search/criteria_reference/logicalnot_criterion.md index 444c2702fb..539cc27e98 100644 --- a/docs/search/criteria_reference/logicalnot_criterion.md +++ b/docs/search/criteria_reference/logicalnot_criterion.md @@ -14,7 +14,7 @@ It takes only one Criterion in the array parameter. ## Example -``` php +``` php skip-validation $query->filter = new Criterion\LogicalNot( new Criterion\ContentTypeIdentifier($contentTypeId) ); diff --git a/docs/search/criteria_reference/logicalor_criterion.md b/docs/search/criteria_reference/logicalor_criterion.md index 657f9c94ec..e3985fe5f4 100644 --- a/docs/search/criteria_reference/logicalor_criterion.md +++ b/docs/search/criteria_reference/logicalor_criterion.md @@ -16,7 +16,7 @@ When querying for [products](product_api.md), use [LogicalOr](/api/php_api/php_a ### PHP -``` php +``` php skip-validation $query->filter = new Criterion\LogicalOr([ new Criterion\ContentTypeIdentifier('article'), new Criterion\SectionIdentifier(['sports', 'news']); diff --git a/docs/search/criteria_reference/maplocationdistance_criterion.md b/docs/search/criteria_reference/maplocationdistance_criterion.md index 6592008687..aa276e55a1 100644 --- a/docs/search/criteria_reference/maplocationdistance_criterion.md +++ b/docs/search/criteria_reference/maplocationdistance_criterion.md @@ -27,6 +27,6 @@ The `MapLocationDistance` Criterion isn't available in [Repository filtering](se ### PHP -``` php +``` php skip-validation $query->query = new Criterion\MapLocationDistance('location', Criterion\Operator::LTE, 5, 51.395973, 22.531696); ``` diff --git a/docs/search/criteria_reference/objectstateid_criterion.md b/docs/search/criteria_reference/objectstateid_criterion.md index f080cbaae9..3c0f6f4a56 100644 --- a/docs/search/criteria_reference/objectstateid_criterion.md +++ b/docs/search/criteria_reference/objectstateid_criterion.md @@ -14,7 +14,7 @@ The [`ObjectStateId` Search Criterion](/api/php_api/php_api_reference/classes/Ib ### PHP -``` php +``` php skip-validation $query->query = new Criterion\ObjectStateId([4, 5]); ``` diff --git a/docs/search/criteria_reference/objectstateidentifier_criterion.md b/docs/search/criteria_reference/objectstateidentifier_criterion.md index 75e7153828..2515b4ee12 100644 --- a/docs/search/criteria_reference/objectstateidentifier_criterion.md +++ b/docs/search/criteria_reference/objectstateidentifier_criterion.md @@ -15,11 +15,11 @@ The [`ObjectStateIdentifier` Search Criterion](/api/php_api/php_api_reference/cl ### PHP -``` php +``` php skip-validation $query->query = new Criterion\ObjectStateIdentifier(['ready']); ``` -``` php +``` php skip-validation $query->query = new Criterion\ObjectStateIdentifier(['not_locked'], 'ibexa_lock'); ``` diff --git a/docs/search/criteria_reference/order_company_associated_criterion.md b/docs/search/criteria_reference/order_company_associated_criterion.md index ee55c07a30..2145a0027d 100644 --- a/docs/search/criteria_reference/order_company_associated_criterion.md +++ b/docs/search/criteria_reference/order_company_associated_criterion.md @@ -15,7 +15,7 @@ The `IsCompanyAssociatedCriterion` Search Criterion searches for orders based on ### PHP -``` php +``` php skip-validation $query = new OrderQuery( new \Ibexa\Contracts\OrderManagement\Value\Order\Query\Criterion\IsCompanyAssociatedCriterion(true) ); diff --git a/docs/search/criteria_reference/order_company_name_criterion.md b/docs/search/criteria_reference/order_company_name_criterion.md index 1f65ad8494..868396566c 100644 --- a/docs/search/criteria_reference/order_company_name_criterion.md +++ b/docs/search/criteria_reference/order_company_name_criterion.md @@ -15,7 +15,7 @@ The `CompanyNameCriterion` Search Criterion searches for orders based on the nam ### PHP -``` php +``` php skip-validation $query = new OrderQuery( new \Ibexa\Contracts\OrderManagement\Value\Order\Query\Criterion\CompanyNameCriterion('IBM') ); diff --git a/docs/search/criteria_reference/order_created_criterion.md b/docs/search/criteria_reference/order_created_criterion.md index aa59007fff..96caabff2d 100644 --- a/docs/search/criteria_reference/order_created_criterion.md +++ b/docs/search/criteria_reference/order_created_criterion.md @@ -16,7 +16,7 @@ The `CreatedAtCriterion` Search Criterion searches for orders based on the date ### PHP -``` php +``` php skip-validation $criteria = new \Ibexa\Contracts\OrderManagement\Value\Order\Query\Criterion\CreatedAtCriterion( new DateTime('2023-03-01'), 'GTE' diff --git a/docs/search/criteria_reference/order_currency_code_criterion.md b/docs/search/criteria_reference/order_currency_code_criterion.md index 9348a743a3..7fef49f5b0 100644 --- a/docs/search/criteria_reference/order_currency_code_criterion.md +++ b/docs/search/criteria_reference/order_currency_code_criterion.md @@ -15,7 +15,7 @@ The `CurrencyCodeCriterion` Search Criterion searches for orders based on the cu ### PHP -``` php +``` php skip-validation $query = new OrderQuery( new \Ibexa\Contracts\OrderManagement\Value\Order\Query\Criterion\CurrencyCodeCriterion('USD') ); diff --git a/docs/search/criteria_reference/order_customer_name_criterion.md b/docs/search/criteria_reference/order_customer_name_criterion.md index 80b0fc08d5..28c2cc0330 100644 --- a/docs/search/criteria_reference/order_customer_name_criterion.md +++ b/docs/search/criteria_reference/order_customer_name_criterion.md @@ -15,7 +15,7 @@ The `CustomerNameCriterion` Search Criterion searches for orders based on the na ### PHP -``` php +``` php skip-validation $query = new OrderQuery( new \Ibexa\Contracts\OrderManagement\Value\Order\Query\Criterion\CustomerNameCriterion('john') ); diff --git a/docs/search/criteria_reference/order_identifier_criterion.md b/docs/search/criteria_reference/order_identifier_criterion.md index 4da72e5ab1..477cb88c71 100644 --- a/docs/search/criteria_reference/order_identifier_criterion.md +++ b/docs/search/criteria_reference/order_identifier_criterion.md @@ -15,7 +15,7 @@ The `IdentifierCriterion` Search Criterion searches for orders based on the orde ### PHP -``` php +``` php skip-validation $query = new OrderQuery( new \Ibexa\Contracts\OrderManagement\Value\Order\Query\Criterion\IdentifierCriterion('f7578972-e7f4-4cae-85dc-a7c74610204e') ); diff --git a/docs/search/criteria_reference/order_owner_criterion.md b/docs/search/criteria_reference/order_owner_criterion.md index 320071b135..474b071e5b 100644 --- a/docs/search/criteria_reference/order_owner_criterion.md +++ b/docs/search/criteria_reference/order_owner_criterion.md @@ -13,7 +13,7 @@ The `OwnerCriterion` Criterion searches for orders based on the user reference. ## Example -``` php +``` php skip-validation $query = new OrderQuery( new \Ibexa\Contracts\OrderManagement\Value\Order\Query\Criterion\OwnerCriterion( \Ibexa\Contracts\Core\Repository\Values\User\UserReference(14) @@ -23,7 +23,7 @@ $query = new OrderQuery( `OwnerCriterion` Criterion accepts also multiple values: -``` php +``` php skip-validation $query = new OrderQuery( new \Ibexa\Contracts\OrderManagement\Value\Order\Query\Criterion\OwnerCriterion( [ @@ -32,4 +32,4 @@ $query = new OrderQuery( ] ) ); -``` \ No newline at end of file +``` diff --git a/docs/search/criteria_reference/order_price_criterion.md b/docs/search/criteria_reference/order_price_criterion.md index 745ca2a126..fbcae057d8 100644 --- a/docs/search/criteria_reference/order_price_criterion.md +++ b/docs/search/criteria_reference/order_price_criterion.md @@ -16,7 +16,7 @@ The `PriceCriterion` searches for orders by their total net value. ### PHP -``` php +``` php skip-validation $criteria = new \Ibexa\Contracts\OrderManagement\Value\Order\Query\Criterion\PriceCriterion( 12900, 'GTE' diff --git a/docs/search/criteria_reference/order_source_criterion.md b/docs/search/criteria_reference/order_source_criterion.md index 53abd3a519..2eb71766c2 100644 --- a/docs/search/criteria_reference/order_source_criterion.md +++ b/docs/search/criteria_reference/order_source_criterion.md @@ -15,7 +15,7 @@ The `SourceCriterion` Search Criterion searches for orders based on the source o ### PHP -``` php +``` php skip-validation $query = new OrderQuery( new \Ibexa\Contracts\OrderManagement\Value\Order\Query\Criterion\SourceCriterion('local_shop') ); diff --git a/docs/search/criteria_reference/order_status_criterion.md b/docs/search/criteria_reference/order_status_criterion.md index e6f3f5cb48..d840fbe3b9 100644 --- a/docs/search/criteria_reference/order_status_criterion.md +++ b/docs/search/criteria_reference/order_status_criterion.md @@ -15,7 +15,7 @@ The `StatusCriterion` Search Criterion searches for orders based on order status ### PHP -``` php +``` php skip-validation $query = new OrderQuery( new \Ibexa\Contracts\OrderManagement\Value\Order\Query\Criterion\StatusCriterion('pending') ); diff --git a/docs/search/criteria_reference/parentlocationid_criterion.md b/docs/search/criteria_reference/parentlocationid_criterion.md index e30307eeb0..c7e75086b1 100644 --- a/docs/search/criteria_reference/parentlocationid_criterion.md +++ b/docs/search/criteria_reference/parentlocationid_criterion.md @@ -15,7 +15,7 @@ searches for content based on the Location ID of its parent. ### PHP -``` php +``` php skip-validation $query->query = new Criterion\ParentLocationId([54, 58]); ``` @@ -45,7 +45,7 @@ $query->query = new Criterion\ParentLocationId([54, 58]); You can use the `ParentLocationId` Search Criterion to list blog posts contained in a blog: -``` php hl_lines="4" +``` php skip-validation hl_lines="4" $query = new LocationQuery(); $query->query = new Criterion\LogicalAnd([ new Criterion\Visibility(Criterion\Visibility::VISIBLE), diff --git a/docs/search/criteria_reference/payment_createdat_criterion.md b/docs/search/criteria_reference/payment_createdat_criterion.md index d43536e7e1..335114e431 100644 --- a/docs/search/criteria_reference/payment_createdat_criterion.md +++ b/docs/search/criteria_reference/payment_createdat_criterion.md @@ -16,7 +16,7 @@ The `CreatedAt` Search Criterion searches for payments based on the date when th ### PHP -``` php +``` php skip-validation $criteria = new \Ibexa\Contracts\Payment\Payment\Query\Criterion\CreatedAt( new DateTime('2023-03-01') ); diff --git a/docs/search/criteria_reference/payment_currency_criterion.md b/docs/search/criteria_reference/payment_currency_criterion.md index 524561faed..0428e1b762 100644 --- a/docs/search/criteria_reference/payment_currency_criterion.md +++ b/docs/search/criteria_reference/payment_currency_criterion.md @@ -15,6 +15,6 @@ The `Currency` Search Criterion searches for payments based on the currency code ### PHP -``` php +``` php skip-validation $query->query = new \Ibexa\Contracts\Payment\Payment\Query\Criterion\Currency('EUR'); ``` diff --git a/docs/search/criteria_reference/payment_id_criterion.md b/docs/search/criteria_reference/payment_id_criterion.md index 3ccd16044d..8e7d7895f7 100644 --- a/docs/search/criteria_reference/payment_id_criterion.md +++ b/docs/search/criteria_reference/payment_id_criterion.md @@ -15,6 +15,6 @@ The `Id` Search Criterion searches for payments based on the payment ID. ### PHP -``` php +``` php skip-validation $query->query = new \Ibexa\Contracts\Payment\Payment\Query\Criterion\Id(2); ``` diff --git a/docs/search/criteria_reference/payment_identifier_criterion.md b/docs/search/criteria_reference/payment_identifier_criterion.md index 0f6ca32dfc..3f6f3ea23f 100644 --- a/docs/search/criteria_reference/payment_identifier_criterion.md +++ b/docs/search/criteria_reference/payment_identifier_criterion.md @@ -15,6 +15,6 @@ The `Identifier` Search Criterion searches for payments based on the payment ide ### PHP -``` php +``` php skip-validation $query->query = new \Ibexa\Contracts\Payment\Payment\Query\Criterion\Identifier('f7578972-e7f4-4cae-85dc-a7c74610204e'); ``` diff --git a/docs/search/criteria_reference/payment_logicaland_criterion.md b/docs/search/criteria_reference/payment_logicaland_criterion.md index fc51f0ab28..f89969b9a6 100644 --- a/docs/search/criteria_reference/payment_logicaland_criterion.md +++ b/docs/search/criteria_reference/payment_logicaland_criterion.md @@ -15,7 +15,7 @@ The `LogicalAnd` Search Criterion matches payments if all provided Criteria matc ### PHP -``` php +``` php skip-validation $query->query = new \Ibexa\Contracts\Payment\Payment\Query\Criterion\LogicalAnd( [ new \Ibexa\Contracts\Payment\Payment\Query\Criterion\CreatedAt(new DateTime('2023-03-01')); diff --git a/docs/search/criteria_reference/payment_logicalor_criterion.md b/docs/search/criteria_reference/payment_logicalor_criterion.md index 0ab036ebc9..8be9fd50a4 100644 --- a/docs/search/criteria_reference/payment_logicalor_criterion.md +++ b/docs/search/criteria_reference/payment_logicalor_criterion.md @@ -15,7 +15,7 @@ The `LogicalOr` Search Criterion matches payments if at least one of the provide ### PHP -``` php +``` php skip-validation $query->query = new Criterion\LogicalOr( [ new \Ibexa\Contracts\Payment\Payment\Query\Criterion\CreatedAt(new DateTime('2023-03-01')); diff --git a/docs/search/criteria_reference/payment_method_createdat_criterion.md b/docs/search/criteria_reference/payment_method_createdat_criterion.md index eac4ce8ab2..438c2c9d53 100644 --- a/docs/search/criteria_reference/payment_method_createdat_criterion.md +++ b/docs/search/criteria_reference/payment_method_createdat_criterion.md @@ -16,7 +16,7 @@ The `CreatedAt` Search Criterion searches for payment methods based on the date ### PHP -``` php +``` php skip-validation $criteria = new \Ibexa\Contracts\Payment\PaymentMethod\Query\Criterion\CreatedAt( new DateTime('2023-03-01') ); diff --git a/docs/search/criteria_reference/payment_method_enabled_criterion.md b/docs/search/criteria_reference/payment_method_enabled_criterion.md index b9671b987d..efcf14100a 100644 --- a/docs/search/criteria_reference/payment_method_enabled_criterion.md +++ b/docs/search/criteria_reference/payment_method_enabled_criterion.md @@ -15,6 +15,6 @@ The `Enabled` Search Criterion searches for payment methods based on whether the ### PHP -``` php +``` php skip-validation $query->query = new \Ibexa\Contracts\Payment\PaymentMethod\Query\Criterion\Enabled(true); ``` diff --git a/docs/search/criteria_reference/payment_method_id_criterion.md b/docs/search/criteria_reference/payment_method_id_criterion.md index c1ca101653..c0a5a873b3 100644 --- a/docs/search/criteria_reference/payment_method_id_criterion.md +++ b/docs/search/criteria_reference/payment_method_id_criterion.md @@ -15,6 +15,6 @@ The `Id` Search Criterion searches for payment methods based on the payment meth ### PHP -``` php +``` php skip-validation $query->query = new \Ibexa\Contracts\Payment\PaymentMethod\Query\Criterion\Id(2); ``` diff --git a/docs/search/criteria_reference/payment_method_identifier_criterion.md b/docs/search/criteria_reference/payment_method_identifier_criterion.md index 04fdcc21a0..f61ce63724 100644 --- a/docs/search/criteria_reference/payment_method_identifier_criterion.md +++ b/docs/search/criteria_reference/payment_method_identifier_criterion.md @@ -15,6 +15,6 @@ The `Identifier` Search Criterion searches for payment methods based on the paym ### PHP -``` php +``` php skip-validation $query->query = new \Ibexa\Contracts\Payment\PaymentMethod\Query\Criterion\Identifier('f7578972-e7f4-4cae-85dc-a7c74610204e'); ``` diff --git a/docs/search/criteria_reference/payment_method_logicaland_criterion.md b/docs/search/criteria_reference/payment_method_logicaland_criterion.md index b903040e18..807e461b8f 100644 --- a/docs/search/criteria_reference/payment_method_logicaland_criterion.md +++ b/docs/search/criteria_reference/payment_method_logicaland_criterion.md @@ -15,7 +15,7 @@ The `LogicalAnd` Search Criterion matches payment methods if all provided Criter ### PHP -``` php +``` php skip-validation $query->query = new \Ibexa\Contracts\Payment\PaymentMethod\Query\Criterion\LogicalAnd( [ new \Ibexa\Contracts\Payment\PaymentMethod\Query\Criterion\CreatedAt(new DateTime('2023-03-01')); diff --git a/docs/search/criteria_reference/payment_method_logicalor_criterion.md b/docs/search/criteria_reference/payment_method_logicalor_criterion.md index 92b0992efe..9b4d21ad46 100644 --- a/docs/search/criteria_reference/payment_method_logicalor_criterion.md +++ b/docs/search/criteria_reference/payment_method_logicalor_criterion.md @@ -15,7 +15,7 @@ The `LogicalOr` Search Criterion matches payment methods if at least one of the ### PHP -``` php +``` php skip-validation $query->query = new \Ibexa\Contracts\Payment\PaymentMethod\Query\Criterion\LogicalOr( [ new \Ibexa\Contracts\Payment\PaymentMethod\Query\Criterion\CreatedAt(new DateTime('2023-03-01')); diff --git a/docs/search/criteria_reference/payment_method_name_criterion.md b/docs/search/criteria_reference/payment_method_name_criterion.md index 0131233c5c..275894cef0 100644 --- a/docs/search/criteria_reference/payment_method_name_criterion.md +++ b/docs/search/criteria_reference/payment_method_name_criterion.md @@ -15,6 +15,6 @@ The `Name` Search Criterion searches for payment methods based on the existing p ### PHP -``` php +``` php skip-validation $query->query = new \Ibexa\Contracts\Payment\PaymentMethod\Query\Criterion\Name('Credit Card'); ``` diff --git a/docs/search/criteria_reference/payment_method_type_criterion.md b/docs/search/criteria_reference/payment_method_type_criterion.md index db7e4be3c9..6429554cad 100644 --- a/docs/search/criteria_reference/payment_method_type_criterion.md +++ b/docs/search/criteria_reference/payment_method_type_criterion.md @@ -15,6 +15,6 @@ The `Type` Search Criterion searches for payment methods based on payment method ### PHP -``` php +``` php skip-validation $query->query = new \Ibexa\Contracts\Payment\PaymentMethod\Query\Criterion\Type('offline'); ``` diff --git a/docs/search/criteria_reference/payment_method_updatedat_criterion.md b/docs/search/criteria_reference/payment_method_updatedat_criterion.md index be34b4d8d6..57319354d4 100644 --- a/docs/search/criteria_reference/payment_method_updatedat_criterion.md +++ b/docs/search/criteria_reference/payment_method_updatedat_criterion.md @@ -16,7 +16,7 @@ The `UpdatedAt` Search Criterion searches for payment methods based on the date ### PHP -``` php +``` php skip-validation $criteria = new \Ibexa\Contracts\Payment\PaymentMethod\Query\Criterion\UpdatedAt( new DateTime('2023-03-01') ); diff --git a/docs/search/criteria_reference/payment_order_criterion.md b/docs/search/criteria_reference/payment_order_criterion.md index 05b8eacc1a..4c2d221741 100644 --- a/docs/search/criteria_reference/payment_order_criterion.md +++ b/docs/search/criteria_reference/payment_order_criterion.md @@ -15,6 +15,6 @@ The `Order` Search Criterion searches for payments based on an ID of an associat ### PHP -``` php +``` php skip-validation $query->query = new \Ibexa\Contracts\Payment\Payment\Query\Criterion\Order(4); ``` diff --git a/docs/search/criteria_reference/payment_payment_method_criterion.md b/docs/search/criteria_reference/payment_payment_method_criterion.md index 1b9bba10b2..79c40f38c0 100644 --- a/docs/search/criteria_reference/payment_payment_method_criterion.md +++ b/docs/search/criteria_reference/payment_payment_method_criterion.md @@ -15,6 +15,6 @@ The `PaymentMethod` Search Criterion searches for payments based on a payment me ### PHP -``` php +``` php skip-validation $query->query = new \Ibexa\Contracts\Payment\Payment\Query\Criterion\PaymentMethod(2); ``` diff --git a/docs/search/criteria_reference/payment_status_criterion.md b/docs/search/criteria_reference/payment_status_criterion.md index c0a037e994..360bb3a964 100644 --- a/docs/search/criteria_reference/payment_status_criterion.md +++ b/docs/search/criteria_reference/payment_status_criterion.md @@ -15,6 +15,6 @@ The `Status` Search Criterion searches for payments based on payment status. ### PHP -``` php +``` php skip-validation $query->query = new \Ibexa\Contracts\Payment\Payment\Query\Criterion\Status('failed'); ``` diff --git a/docs/search/criteria_reference/payment_updatedat_criterion.md b/docs/search/criteria_reference/payment_updatedat_criterion.md index ec947465a8..f596062d1e 100644 --- a/docs/search/criteria_reference/payment_updatedat_criterion.md +++ b/docs/search/criteria_reference/payment_updatedat_criterion.md @@ -16,7 +16,7 @@ The `UpdatedAt` Search Criterion searches for payments based on the date when th ### PHP -``` php +``` php skip-validation $criteria = new \Ibexa\Contracts\Payment\Payment\Query\Criterion\UpdatedAt( new DateTime('2023-03-01') ); diff --git a/docs/search/criteria_reference/price_currency_criterion.md b/docs/search/criteria_reference/price_currency_criterion.md index 8d3dd0a10b..566fce2a81 100644 --- a/docs/search/criteria_reference/price_currency_criterion.md +++ b/docs/search/criteria_reference/price_currency_criterion.md @@ -14,7 +14,7 @@ The `Currency` Search Criterion searches for prices based on the given currency. ### PHP -``` php +``` php skip-validation $currency = $priceService->getPriceById('EUR'); $query = new PriceQuery( diff --git a/docs/search/criteria_reference/price_customergroup_criterion.md b/docs/search/criteria_reference/price_customergroup_criterion.md index a23aa07446..18c3447c59 100644 --- a/docs/search/criteria_reference/price_customergroup_criterion.md +++ b/docs/search/criteria_reference/price_customergroup_criterion.md @@ -14,7 +14,7 @@ The `CustomerGroup` Search Criterion searches for prices based on the customer g ### PHP -``` php +``` php skip-validation $customerGroup = $customerGroupService->getCustomerGroup(123); $query = new PriceQuery( diff --git a/docs/search/criteria_reference/price_isbaseprice_criterion.md b/docs/search/criteria_reference/price_isbaseprice_criterion.md index 28e8cd2478..6212c78d9f 100644 --- a/docs/search/criteria_reference/price_isbaseprice_criterion.md +++ b/docs/search/criteria_reference/price_isbaseprice_criterion.md @@ -18,8 +18,8 @@ The `IsBasePrice` Criterion isn't available in Solr or Elasticsearch engines. ### PHP -``` php +``` php skip-validation $query = new PriceQuery( new \Ibexa\Contracts\ProductCatalog\Values\Price\Query\Criterion\IsBasePrice() ); -``` \ No newline at end of file +``` diff --git a/docs/search/criteria_reference/price_iscustomprice_criterion.md b/docs/search/criteria_reference/price_iscustomprice_criterion.md index 9793e76b44..08942fb077 100644 --- a/docs/search/criteria_reference/price_iscustomprice_criterion.md +++ b/docs/search/criteria_reference/price_iscustomprice_criterion.md @@ -18,8 +18,8 @@ The `IsCustomPrice` Criterion isn't available in Solr or Elasticsearch engines. ### PHP -``` php +``` php skip-validation $query = new PriceQuery( new \Ibexa\Contracts\ProductCatalog\Values\Price\Query\Criterion\IsCustomPrice() ); -``` \ No newline at end of file +``` diff --git a/docs/search/criteria_reference/price_logicaland_criterion.md b/docs/search/criteria_reference/price_logicaland_criterion.md index ee9ab7c48b..9d0dedd851 100644 --- a/docs/search/criteria_reference/price_logicaland_criterion.md +++ b/docs/search/criteria_reference/price_logicaland_criterion.md @@ -15,7 +15,7 @@ The `LogicalAnd` Search Criterion matches prices if all provided Criteria match. ### PHP -``` php +``` php skip-validation $query->query = new \Ibexa\Contracts\ProductCatalog\Values\Price\Query\Criterion\LogicalAnd( [ new \Ibexa\Contracts\ProductCatalog\Values\Price\Query\Criterion\Currency('USD'), diff --git a/docs/search/criteria_reference/price_logicalor_criterion.md b/docs/search/criteria_reference/price_logicalor_criterion.md index d3e93a6dc9..b6c5feb9b8 100644 --- a/docs/search/criteria_reference/price_logicalor_criterion.md +++ b/docs/search/criteria_reference/price_logicalor_criterion.md @@ -15,7 +15,7 @@ The `LogicalOr` Search Criterion matches prices if at least one of the provided ### PHP -``` php +``` php skip-validation $query->query = new \Ibexa\Contracts\ProductCatalog\Values\Price\Query\Criterion\LogicalOr( [ new \Ibexa\Contracts\ProductCatalog\Values\Price\Query\Criterion\Currency('USD'), diff --git a/docs/search/criteria_reference/price_product_criterion.md b/docs/search/criteria_reference/price_product_criterion.md index 6aaf93a57d..4bc7341f0b 100644 --- a/docs/search/criteria_reference/price_product_criterion.md +++ b/docs/search/criteria_reference/price_product_criterion.md @@ -14,7 +14,7 @@ The `Product` Search Criterion searches for prices based on product codes. ### PHP -``` php +``` php skip-validation $query = new PriceQuery( new \Ibexa\Contracts\ProductCatalog\Values\Price\Query\Criterion\Product('ergo_desk') ); diff --git a/docs/search/criteria_reference/priority_criterion.md b/docs/search/criteria_reference/priority_criterion.md index 34975939d0..952c14067f 100644 --- a/docs/search/criteria_reference/priority_criterion.md +++ b/docs/search/criteria_reference/priority_criterion.md @@ -22,6 +22,6 @@ The `value` argument requires: ### PHP -``` php +``` php skip-validation $query->query = new Criterion\Location\Priority(Criterion\Operator::GTE, 50); ``` diff --git a/docs/search/criteria_reference/productavailability_criterion.md b/docs/search/criteria_reference/productavailability_criterion.md index 21d0455641..becfcae751 100644 --- a/docs/search/criteria_reference/productavailability_criterion.md +++ b/docs/search/criteria_reference/productavailability_criterion.md @@ -14,7 +14,7 @@ The `ProductAvailability` Search Criterion searches for products by their availa ### PHP -``` php +``` php skip-validation $query = new ProductQuery( null, new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\ProductAvailability(true) @@ -43,4 +43,4 @@ $query = new ProductQuery( } } } - ``` \ No newline at end of file + ``` diff --git a/docs/search/criteria_reference/productcategory_criterion.md b/docs/search/criteria_reference/productcategory_criterion.md index 76d5fa0002..723c72ecd0 100644 --- a/docs/search/criteria_reference/productcategory_criterion.md +++ b/docs/search/criteria_reference/productcategory_criterion.md @@ -14,7 +14,7 @@ The `ProductCategory` Search Criterion searches for products by the category the ### PHP -``` php +``` php skip-validation $query = new ProductQuery( null, new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\ProductCategory([2, 3]) diff --git a/docs/search/criteria_reference/productcode_criterion.md b/docs/search/criteria_reference/productcode_criterion.md index 78655b834d..33a8c9ca24 100644 --- a/docs/search/criteria_reference/productcode_criterion.md +++ b/docs/search/criteria_reference/productcode_criterion.md @@ -14,7 +14,7 @@ The `ProductCode` Search Criterion searches for products by their codes. ### PHP -``` php +``` php skip-validation $query = new ProductQuery( null, new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\ProductCode(['ergo_desk', 'alter_desk']) @@ -47,4 +47,4 @@ $query = new ProductQuery( } } } - ``` \ No newline at end of file + ``` diff --git a/docs/search/criteria_reference/productname_criterion.md b/docs/search/criteria_reference/productname_criterion.md index b19a270ae8..53932d8c31 100644 --- a/docs/search/criteria_reference/productname_criterion.md +++ b/docs/search/criteria_reference/productname_criterion.md @@ -14,7 +14,7 @@ The `ProductName` Search Criterion searches for products by their names. ### PHP -``` php +``` php skip-validation $query = new ProductQuery( null, new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\ProductName('sofa*') diff --git a/docs/search/criteria_reference/productstock_criterion.md b/docs/search/criteria_reference/productstock_criterion.md index ed88bc178c..8689025e51 100644 --- a/docs/search/criteria_reference/productstock_criterion.md +++ b/docs/search/criteria_reference/productstock_criterion.md @@ -15,14 +15,14 @@ The `ProductStock` Search Criterion searches for products by their numerical sto ### PHP -``` php +``` php skip-validation $productQuery = new ProductQuery( null, new Criterion\ProductStock(10) ); ``` -``` php +``` php skip-validation $productQuery = new ProductQuery( null, new Criterion\ProductStock(50, '>=') diff --git a/docs/search/criteria_reference/productstockrange_criterion.md b/docs/search/criteria_reference/productstockrange_criterion.md index f71c7f5adc..16bc837d6a 100644 --- a/docs/search/criteria_reference/productstockrange_criterion.md +++ b/docs/search/criteria_reference/productstockrange_criterion.md @@ -15,7 +15,7 @@ The `ProductStockRange` Search Criterion searches for products by their numerica ### PHP -``` php +``` php skip-validation $productQuery = new ProductQuery( null, new Criterion\ProductStockRange(10, 120) diff --git a/docs/search/criteria_reference/producttype_criterion.md b/docs/search/criteria_reference/producttype_criterion.md index aab290dcc7..7cc9ab2b0d 100644 --- a/docs/search/criteria_reference/producttype_criterion.md +++ b/docs/search/criteria_reference/producttype_criterion.md @@ -14,7 +14,7 @@ The `ProductType` Search Criterion searches for products by their codes. ### PHP -``` php +``` php skip-validation $query = new ProductQuery( null, new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\ProductType(['dress']) @@ -43,4 +43,4 @@ $query = new ProductQuery( } } } - ``` \ No newline at end of file + ``` diff --git a/docs/search/criteria_reference/rangemeasurementattributemaximum_criterion.md b/docs/search/criteria_reference/rangemeasurementattributemaximum_criterion.md index c28be6ffd8..7608e4f832 100644 --- a/docs/search/criteria_reference/rangemeasurementattributemaximum_criterion.md +++ b/docs/search/criteria_reference/rangemeasurementattributemaximum_criterion.md @@ -15,7 +15,7 @@ The `RangeMeasurementAttributeMaximum` Search Criterion searches for products by ### PHP -``` php +``` php skip-validation $value = $this->measurementService->buildSimpleValue('length', 150, 'centimeter'); $query = new ProductQuery( diff --git a/docs/search/criteria_reference/rangemeasurementattributeminimum_criterion.md b/docs/search/criteria_reference/rangemeasurementattributeminimum_criterion.md index fb5d54dbad..546743cf97 100644 --- a/docs/search/criteria_reference/rangemeasurementattributeminimum_criterion.md +++ b/docs/search/criteria_reference/rangemeasurementattributeminimum_criterion.md @@ -15,7 +15,7 @@ The `RangeMeasurementAttributeMinimum` Search Criterion searches for products by ### PHP -``` php +``` php skip-validation $value = $this->measurementService->buildSimpleValue('length', 100, 'centimeter'); $query = new ProductQuery( diff --git a/docs/search/criteria_reference/remoteid_criterion.md b/docs/search/criteria_reference/remoteid_criterion.md index 6677715cda..e20441c2db 100644 --- a/docs/search/criteria_reference/remoteid_criterion.md +++ b/docs/search/criteria_reference/remoteid_criterion.md @@ -15,7 +15,7 @@ searches for content based on its remote content ID. ### PHP -``` php +``` php skip-validation $query->query = new Criterion\RemoteId('abab615dcf26699a4291657152da4337'); ``` diff --git a/docs/search/criteria_reference/sectionid_criterion.md b/docs/search/criteria_reference/sectionid_criterion.md index cfdc257ccb..98ee02f6bd 100644 --- a/docs/search/criteria_reference/sectionid_criterion.md +++ b/docs/search/criteria_reference/sectionid_criterion.md @@ -14,7 +14,7 @@ The [`SectionId` Search Criterion](/api/php_api/php_api_reference/classes/Ibexa- ### PHP -``` php +``` php skip-validation $query->query = new Criterion\SectionId(3); ``` diff --git a/docs/search/criteria_reference/sectionidentifier_criterion.md b/docs/search/criteria_reference/sectionidentifier_criterion.md index dea856b606..fbe42f3117 100644 --- a/docs/search/criteria_reference/sectionidentifier_criterion.md +++ b/docs/search/criteria_reference/sectionidentifier_criterion.md @@ -14,7 +14,7 @@ The [`SectionIdentifier` Search Criterion](/api/php_api/php_api_reference/classe ### PHP -``` php +``` php skip-validation $query->query = new Criterion\SectionIdentifier(['sports', 'news']); ``` diff --git a/docs/search/criteria_reference/selectionattribute_criterion.md b/docs/search/criteria_reference/selectionattribute_criterion.md index f8eeeed167..2b91dee1a1 100644 --- a/docs/search/criteria_reference/selectionattribute_criterion.md +++ b/docs/search/criteria_reference/selectionattribute_criterion.md @@ -15,7 +15,7 @@ The `SelectionAttribute` Search Criterion searches for products by the value of ### PHP -``` php +``` php skip-validation $query = new ProductQuery( null, new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\Criterion\SelectionAttribute( @@ -55,4 +55,4 @@ $query = new ProductQuery( } } } - ``` \ No newline at end of file + ``` diff --git a/docs/search/criteria_reference/shipment_createdat_criterion.md b/docs/search/criteria_reference/shipment_createdat_criterion.md index be1ed48ff6..86ee0c68b0 100644 --- a/docs/search/criteria_reference/shipment_createdat_criterion.md +++ b/docs/search/criteria_reference/shipment_createdat_criterion.md @@ -16,7 +16,7 @@ The `CreatedAt` Search Criterion searches for shipments based on the date when t ### PHP -``` php +``` php skip-validation $criteria = new \Ibexa\Contracts\Shipping\Shipment\Query\Criterion\CreatedAt( new DateTime('2023-03-01 14:07:02'), 'GTE' diff --git a/docs/search/criteria_reference/shipment_currency_criterion.md b/docs/search/criteria_reference/shipment_currency_criterion.md index eeb2e7e9b2..0fb131d79f 100644 --- a/docs/search/criteria_reference/shipment_currency_criterion.md +++ b/docs/search/criteria_reference/shipment_currency_criterion.md @@ -15,7 +15,7 @@ The `Currency` Search Criterion searches for shipments based on the currency cod ### PHP -``` php +``` php skip-validation $query = new ShipmentQuery( new \Ibexa\Contracts\Shipping\Shipment\Query\Criterion\Currency('USD', 'CZK') ); diff --git a/docs/search/criteria_reference/shipment_id_criterion.md b/docs/search/criteria_reference/shipment_id_criterion.md index 782150cccd..2a489f5ec6 100644 --- a/docs/search/criteria_reference/shipment_id_criterion.md +++ b/docs/search/criteria_reference/shipment_id_criterion.md @@ -15,7 +15,7 @@ The `Id` Search Criterion searches for shipments based on the shipment ID. ### PHP -``` php +``` php skip-validation $query = new ShipmentQuery( new \Ibexa\Contracts\Shipping\Shipment\Query\Criterion\Id(2) ); diff --git a/docs/search/criteria_reference/shipment_identifier_criterion.md b/docs/search/criteria_reference/shipment_identifier_criterion.md index df67826223..0558112629 100644 --- a/docs/search/criteria_reference/shipment_identifier_criterion.md +++ b/docs/search/criteria_reference/shipment_identifier_criterion.md @@ -15,7 +15,7 @@ The `Identifier` Search Criterion searches for shipments based on the shipment i ### PHP -``` php +``` php skip-validation $query = new ShipmentQuery( new \Ibexa\Contracts\Shipping\Shipment\Query\Criterion\Identifier('f1t7z-3rb3rt') ); diff --git a/docs/search/criteria_reference/shipment_logicaland_criterion.md b/docs/search/criteria_reference/shipment_logicaland_criterion.md index c77c345282..0c55981406 100644 --- a/docs/search/criteria_reference/shipment_logicaland_criterion.md +++ b/docs/search/criteria_reference/shipment_logicaland_criterion.md @@ -15,7 +15,7 @@ The `LogicalAnd` Search Criterion matches shipments if all provided Criteria mat ### PHP -``` php +``` php skip-validation $query->query = new \Ibexa\Contracts\Shipping\Shipment\Query\Criterion\LogicalAnd( [ new \Ibexa\Contracts\Shipping\Shipment\Query\Criterion\CreatedAt(new DateTime('2023-03-01')), diff --git a/docs/search/criteria_reference/shipment_logicalor_criterion.md b/docs/search/criteria_reference/shipment_logicalor_criterion.md index 2903abb758..a04f5335ed 100644 --- a/docs/search/criteria_reference/shipment_logicalor_criterion.md +++ b/docs/search/criteria_reference/shipment_logicalor_criterion.md @@ -15,7 +15,7 @@ The `LogicalOr` Search Criterion matches shipments if at least one of the provid ### PHP -``` php +``` php skip-validation $query->query = new \Ibexa\Contracts\Shipping\Shipment\Query\Criterion\LogicalOr( [ new \Ibexa\Contracts\Shipping\Shipment\Query\Criterion\CreatedAt(new DateTime('2023-03-01')), diff --git a/docs/search/criteria_reference/shipment_owner_criterion.md b/docs/search/criteria_reference/shipment_owner_criterion.md index 79c9e81c3c..4dc835f136 100644 --- a/docs/search/criteria_reference/shipment_owner_criterion.md +++ b/docs/search/criteria_reference/shipment_owner_criterion.md @@ -13,7 +13,7 @@ The `Owner` Criterion searches for shipments based on the user reference. ## Example -``` php +``` php skip-validation $query = new ShipmentQuery( new \Ibexa\Contracts\Shipping\Shipment\Query\Criterion\Owner( \Ibexa\Contracts\Core\Repository\Values\User\UserReference(14) @@ -23,7 +23,7 @@ $query = new ShipmentQuery( `Owner` Criterion accepts also multiple values: -``` php +``` php skip-validation $query = new ShipmentQuery( new \Ibexa\Contracts\Shipping\Shipment\Query\Criterion\Owner( [ @@ -32,4 +32,4 @@ $query = new ShipmentQuery( ] ) ); -``` \ No newline at end of file +``` diff --git a/docs/search/criteria_reference/shipment_shipping_method_criterion.md b/docs/search/criteria_reference/shipment_shipping_method_criterion.md index 2a503ead43..25f8c39c28 100644 --- a/docs/search/criteria_reference/shipment_shipping_method_criterion.md +++ b/docs/search/criteria_reference/shipment_shipping_method_criterion.md @@ -15,7 +15,7 @@ The `ShippingMethod` Search Criterion searches for shipments based on a shipping ### PHP -``` php +``` php skip-validation $query = new ShipmentQuery( new \Ibexa\Contracts\Shipping\Shipment\Query\Criterion\ShippingMethod($shippingMethod) ); diff --git a/docs/search/criteria_reference/shipment_status_criterion.md b/docs/search/criteria_reference/shipment_status_criterion.md index 3e2c0d40bc..fc50c9bdd0 100644 --- a/docs/search/criteria_reference/shipment_status_criterion.md +++ b/docs/search/criteria_reference/shipment_status_criterion.md @@ -15,7 +15,7 @@ The `Status` Search Criterion searches for shipments based on shipment status. ### PHP -``` php +``` php skip-validation $query = new ShipmentQuery( new \Ibexa\Contracts\Shipping\Shipment\Query\Criterion\Status('pending') ); diff --git a/docs/search/criteria_reference/shipment_updatedat_criterion.md b/docs/search/criteria_reference/shipment_updatedat_criterion.md index e7e84e13b7..e31cd94e6d 100644 --- a/docs/search/criteria_reference/shipment_updatedat_criterion.md +++ b/docs/search/criteria_reference/shipment_updatedat_criterion.md @@ -16,7 +16,7 @@ The `UpdatedAt` Search Criterion searches for shipments based on the date when t ### PHP -``` php +``` php skip-validation $criteria = new \Ibexa\Contracts\Shipping\Shipment\Query\Criterion\UpdatedAt( new DateTime('2023-03-01'), 'GTE' diff --git a/docs/search/criteria_reference/sibling_criterion.md b/docs/search/criteria_reference/sibling_criterion.md index 0a3780c3c7..77708daa87 100644 --- a/docs/search/criteria_reference/sibling_criterion.md +++ b/docs/search/criteria_reference/sibling_criterion.md @@ -15,13 +15,13 @@ The [`Sibling` Search Criterion](/api/php_api/php_api_reference/classes/Ibexa-Co ### PHP -``` php +``` php skip-validation $query->query = new Criterion\Sibling(59, 2); ``` You can also use the named constructor `Criterion\Sibling::fromLocation` and provide it with the location object: -``` php +``` php skip-validation $location = $locationService->loadLocation(59); $query->query = Criterion\Sibling::fromLocation($location); ``` diff --git a/docs/search/criteria_reference/simplemeasurementattribute_criterion.md b/docs/search/criteria_reference/simplemeasurementattribute_criterion.md index 034a221ed7..e45f5365b7 100644 --- a/docs/search/criteria_reference/simplemeasurementattribute_criterion.md +++ b/docs/search/criteria_reference/simplemeasurementattribute_criterion.md @@ -15,7 +15,7 @@ The `SimpleMeasurementAttribute` Search Criterion searches for products by the v ### PHP -``` php +``` php skip-validation $value = $this->measurementService->buildSimpleValue('length', 120, 'centimeter'); $query = new ProductQuery( diff --git a/docs/search/criteria_reference/subtree_criterion.md b/docs/search/criteria_reference/subtree_criterion.md index a814f314fa..5747a6d495 100644 --- a/docs/search/criteria_reference/subtree_criterion.md +++ b/docs/search/criteria_reference/subtree_criterion.md @@ -15,7 +15,7 @@ It returns the content item and all the content items below it in the subtree. ### PHP -``` php +``` php skip-validation $query->query = new Criterion\Subtree('/1/2/71/72/'); ``` diff --git a/docs/search/criteria_reference/taxonomy_entry_id.md b/docs/search/criteria_reference/taxonomy_entry_id.md index 1cceaeccc2..372c3345db 100644 --- a/docs/search/criteria_reference/taxonomy_entry_id.md +++ b/docs/search/criteria_reference/taxonomy_entry_id.md @@ -14,12 +14,12 @@ The [`TaxonomyEntryId` Search Criterion](/api/php_api/php_api_reference/classes/ ### PHP -``` php +``` php skip-validation $query->query = new Criterion\TaxonomyEntryId(1); ``` Add an array of ID's to find Content tagged with at least one of the tags (OR). -```php +```php skip-validation $query->query = new Criterion\TaxonomyEntryId([1, 2, 3]); ``` diff --git a/docs/search/criteria_reference/useremail_criterion.md b/docs/search/criteria_reference/useremail_criterion.md index 7cc730e21f..bab5df6a45 100644 --- a/docs/search/criteria_reference/useremail_criterion.md +++ b/docs/search/criteria_reference/useremail_criterion.md @@ -19,11 +19,11 @@ Solr search engine and Elasticsearch support IN and EQ operators only. ### PHP -``` php +``` php skip-validation $query->query = new Criterion\UserEmail(['johndoe']); ``` -``` php +``` php skip-validation $query->query = new Criterion\UserEmail('nospam*', Criterion\Operator::LIKE); ``` diff --git a/docs/search/criteria_reference/userid_criterion.md b/docs/search/criteria_reference/userid_criterion.md index 0468cffdbc..32877eb142 100644 --- a/docs/search/criteria_reference/userid_criterion.md +++ b/docs/search/criteria_reference/userid_criterion.md @@ -14,7 +14,7 @@ The [`UserId` Search Criterion](/api/php_api/php_api_reference/classes/Ibexa-Con ### PHP -``` php +``` php skip-validation $query->query = new Criterion\UserId([14]); ``` diff --git a/docs/search/criteria_reference/userlogin_criterion.md b/docs/search/criteria_reference/userlogin_criterion.md index a3c6f048b4..3573b5ea11 100644 --- a/docs/search/criteria_reference/userlogin_criterion.md +++ b/docs/search/criteria_reference/userlogin_criterion.md @@ -19,11 +19,11 @@ Solr search engine and Elasticsearch support IN and EQ operators only. ### PHP -``` php +``` php skip-validation $query->query = new Criterion\UserLogin(['johndoe']); ``` -``` php +``` php skip-validation $query->query = new Criterion\UserLogin('adm*', Criterion\Operator::LIKE); ``` diff --git a/docs/search/criteria_reference/usermetadata_criterion.md b/docs/search/criteria_reference/usermetadata_criterion.md index 54a9d0725b..163757caff 100644 --- a/docs/search/criteria_reference/usermetadata_criterion.md +++ b/docs/search/criteria_reference/usermetadata_criterion.md @@ -16,7 +16,7 @@ The [`UserMetadata` Search Criterion](/api/php_api/php_api_reference/classes/Ibe ### PHP -``` php +``` php skip-validation $query->query = new Criterion\UserMetadata(Criterion\UserMetadata::GROUP, Criterion\Operator::EQ, 12); ``` @@ -56,7 +56,7 @@ $query->query = new Criterion\UserMetadata(Criterion\UserMetadata::GROUP, Criter You can use the `UserMetadata` Criterion to search for blog posts created by the Contributor user group: -``` php hl_lines="7" +``` php skip-validation hl_lines="7" // ID of your custom Contributor User Group $contributorGroupId = 32; diff --git a/docs/search/criteria_reference/visibility_criterion.md b/docs/search/criteria_reference/visibility_criterion.md index 50ba1f4c47..7840a94954 100644 --- a/docs/search/criteria_reference/visibility_criterion.md +++ b/docs/search/criteria_reference/visibility_criterion.md @@ -20,7 +20,7 @@ Use Location Search to avoid this. ### PHP -``` php +``` php skip-validation $query->query = new Criterion\Visibility(Criterion\Visibility::HIDDEN); ``` diff --git a/docs/search/extensibility/create_custom_aggregation.md b/docs/search/extensibility/create_custom_aggregation.md index 44af319e63..8a739c8175 100644 --- a/docs/search/extensibility/create_custom_aggregation.md +++ b/docs/search/extensibility/create_custom_aggregation.md @@ -9,7 +9,7 @@ description: Create custom Aggregation to use with Solr and Elasticsearch search To create a custom Aggregation, create an aggregation class. In the following example, an aggregation groups the location query results by the location priority: -``` php +``` php skip-validation --8<-- code_samples/search/custom/src/Query/Aggregation/PriorityRangeAggregation.php --8<-- @@ -138,7 +138,7 @@ In a more complex use case, you must create your own visitor and extractor. The aggregation visitor must implement [`Ibexa\Contracts\Solr\Query\AggregationVisitor`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Solr-Query-AggregationVisitor.html): - ``` php + ``` php skip-validation --8<-- code_samples/search/custom/src/Query/Aggregation/Solr/PriorityRangeAggregationVisitor.php --8<-- @@ -148,7 +148,7 @@ In a more complex use case, you must create your own visitor and extractor. The aggregation visitor must implement [`Ibexa\Contracts\ElasticSearchEngine\Query\AggregationVisitor`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Elasticsearch-Query-AggregationVisitor.html): - ``` php + ``` php skip-validation --8<-- code_samples/search/custom/src/Query/Aggregation/Elasticsearch/PriorityRangeAggregationVisitor.php --8<-- @@ -189,7 +189,7 @@ Finally, register the aggregation visitor as a service. You must also create a result extractor, which implements [`Ibexa\Contracts\Solr\ResultExtractor\AggregationResultExtractor`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Solr-ResultExtractor-AggregationResultExtractor.html) that transforms raw aggregation results from Solr into `AggregationResult` objects: - ``` php + ``` php skip-validation --8<-- code_samples/search/custom/src/Query/Aggregation/Solr/PriorityRangeAggregationResultExtractor.php --8<-- @@ -203,7 +203,7 @@ Finally, register the aggregation visitor as a service. You must also create a result extractor, which implements [`Ibexa\Contracts\ElasticSearchEngine\Query\AggregationResultExtractor`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Elasticsearch-Query-AggregationResultExtractor.html) that transforms raw aggregation results from Elasticsearch into `AggregationResult` objects: - ``` php + ``` php skip-validation --8<-- code_samples/search/custom/src/Query/Aggregation/Elasticsearch/PriorityRangeAggregationResultExtractor.php --8<-- diff --git a/docs/search/extensibility/create_custom_search_criterion.md b/docs/search/extensibility/create_custom_search_criterion.md index eea7f735e8..1498ca7863 100644 --- a/docs/search/extensibility/create_custom_search_criterion.md +++ b/docs/search/extensibility/create_custom_search_criterion.md @@ -10,7 +10,7 @@ To provide support for a custom Search Criterion, do the following. First, create a `CameraManufacturerCriterion.php` file that contains the Criterion class: -``` php +``` php skip-validation --8<-- code_samples/search/custom/src/Query/Criterion/CameraManufacturerCriterion.php --8<-- @@ -22,7 +22,7 @@ Then, add a `CameraManufacturerVisitor` class, implementing `CriterionVisitor`: === "Solr" - ``` php + ``` php skip-validation --8<-- code_samples/search/custom/src/Query/Criterion/Solr/CameraManufacturerVisitor.php --8<-- @@ -30,7 +30,7 @@ Then, add a `CameraManufacturerVisitor` class, implementing `CriterionVisitor`: === "Elasticsearch" - ``` php + ``` php skip-validation --8<-- code_samples/search/custom/src/Query/Criterion/Elasticsearch/CameraManufacturerVisitor.php --8<-- diff --git a/docs/search/extensibility/create_custom_sort_clause.md b/docs/search/extensibility/create_custom_sort_clause.md index 259f421d39..e8ade9131b 100644 --- a/docs/search/extensibility/create_custom_sort_clause.md +++ b/docs/search/extensibility/create_custom_sort_clause.md @@ -10,7 +10,7 @@ To create a custom Sort Clause, do the following. First, add a `ScoreSortClause.php` file with the Sort Clause class: -``` php +``` php skip-validation --8<-- code_samples/search/custom/src/Query/SortClause/ScoreSortClause.php --8<-- @@ -22,7 +22,7 @@ Then, add a `ScoreVisitor` class that implements `SortClauseVisitor`: === "Solr" - ``` php + ``` php skip-validation --8<-- code_samples/search/custom/src/Query/SortClause/Solr/ScoreVisitor.php --8<-- @@ -30,7 +30,7 @@ Then, add a `ScoreVisitor` class that implements `SortClauseVisitor`: === "Elasticsearch" - ``` php + ``` php skip-validation --8<-- code_samples/search/custom/src/Query/SortClause/Elasticsearch/ScoreVisitor.php --8<-- diff --git a/docs/search/extensibility/index_custom_elasticsearch_data.md b/docs/search/extensibility/index_custom_elasticsearch_data.md index b9c9c215a3..c190206ac2 100644 --- a/docs/search/extensibility/index_custom_elasticsearch_data.md +++ b/docs/search/extensibility/index_custom_elasticsearch_data.md @@ -18,7 +18,7 @@ You can pass the event to a subscriber which gives you access to the document th In the following example, when an index in created for a content or a location document, the event subscriber adds a `custom_field` of the type [`StringField`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Search-FieldType-StringField.html) to the index: -``` php hl_lines="19 20 21" +``` php skip-validation hl_lines="19 20 21" --8<-- code_samples/search/custom/src/EventSubscriber/CustomIndexDataSubscriber.php --8<-- diff --git a/docs/search/extensibility/manipulate_elasticsearch_query.md b/docs/search/extensibility/manipulate_elasticsearch_query.md index d0f41327ba..e7144acc91 100644 --- a/docs/search/extensibility/manipulate_elasticsearch_query.md +++ b/docs/search/extensibility/manipulate_elasticsearch_query.md @@ -11,7 +11,7 @@ The following example shows how to add a Search Criterion to all queries. Depending on your configuration, this might impact all search queries, including those used for search and content tree in the back office. -``` php hl_lines="34" +``` php skip-validation hl_lines="34" --8<-- code_samples/search/custom/src/EventSubscriber/CustomQueryFilterSubscriber.php --8<-- diff --git a/docs/search/search_api.md b/docs/search/search_api.md index e14213a1af..ebbb3b224b 100644 --- a/docs/search/search_api.md +++ b/docs/search/search_api.md @@ -42,7 +42,7 @@ You can also use [`SearchService::findContent`](/api/php_api/php_api_reference/c To query for a single result, for example by providing a Content ID, use the [`SearchService::findSingle`](/api/php_api/php_api_reference/classes/Ibexa-Contracts-Core-Repository-SearchService.html#method_findSingle) method: -``` php +``` php skip-validation $criterion = new Criterion\ContentId($contentId); $result = $this->searchService->findSingle($criterion); $output->writeln($result->getName()); @@ -57,7 +57,7 @@ $output->writeln($result->getName()); By default search returns up to 25 results. You can change it by setting a different limit to the query: - ``` php + ``` php skip-validation $query->limit = 100; ``` @@ -93,7 +93,7 @@ This enables iterating over results that are too large to handle due to memory c `BatchIterator` takes one of the available adapters ([`\Ibexa\Contracts\Core\Repository\Iterator\BatchIteratorAdapter`](/api/php_api/php_api_reference/namespaces/ibexa-contracts-core-repository-iterator-batchiteratoradapter.html)) and optional batch size. For example: -``` php +``` php skip-validation $query = new LocationQuery(); $iterator = new BatchIterator(new BatchIteratorAdapter\LocationSearchAdapter($this->searchService, $query)); @@ -172,7 +172,7 @@ You can use the following methods of the Filter: The following example filters for Folder content items under the parent location 2, sorts them by publication date and returns 10 results, starting from the third one: -``` php +``` php skip-validation $filter = new Filter(); $filter ->withCriterion(new Criterion\ContentTypeIdentifier('folder')) @@ -290,7 +290,7 @@ This can lead to unexpected behavior, for instance because content can have mult For example, a content item has two locations: visible location A and hidden location B. You perform the following query: -``` php +``` php skip-validation $query->filter = new Criterion\LogicalAnd([ new LocationId($bLocationId), new Visibility(Visibility::VISIBLE), @@ -365,7 +365,7 @@ The following example limits the number of terms returned to 5 and only consider To use a range aggregation, you must provide a `ranges` array containing a set of `Range` objects that define the borders of the specific range sets. -``` php +``` php skip-validation $query->aggregations[] = new IntegerRangeAggregation('range', 'person', 'age', [ new Query\Aggregation\Range(1,30), diff --git a/docs/search/search_engines/solr_search_engine/configure_solr.md b/docs/search/search_engines/solr_search_engine/configure_solr.md index e38c5c5db9..74040d9b86 100644 --- a/docs/search/search_engines/solr_search_engine/configure_solr.md +++ b/docs/search/search_engines/solr_search_engine/configure_solr.md @@ -72,7 +72,7 @@ The configuration above results in the following boosting (content type / Field) The second step requires you to use `\Novactive\EzSolrSearchExtra\Query\Content\Criterion\MultipleFieldsFullText` instead of default `\Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion\FullText`. The following example shows custom query which benefits from the custom fields created in the previous example. - ```php + ```php skip-validation sortClauses = [new SortClause\ContentId()]; ``` diff --git a/docs/search/sort_clause_reference/contentname_sort_clause.md b/docs/search/sort_clause_reference/contentname_sort_clause.md index 9f1106a4b5..83f55f861d 100644 --- a/docs/search/sort_clause_reference/contentname_sort_clause.md +++ b/docs/search/sort_clause_reference/contentname_sort_clause.md @@ -12,7 +12,7 @@ The [`ContentName` Sort Clause](/api/php_api/php_api_reference/classes/Ibexa-Con ## Example -``` php +``` php skip-validation $query = new LocationQuery(); $query->sortClauses = [new SortClause\ContentName()]; ``` diff --git a/docs/search/sort_clause_reference/contenttranslatedname_sort_clause.md b/docs/search/sort_clause_reference/contenttranslatedname_sort_clause.md index 957cc93109..52588e6908 100644 --- a/docs/search/sort_clause_reference/contenttranslatedname_sort_clause.md +++ b/docs/search/sort_clause_reference/contenttranslatedname_sort_clause.md @@ -16,7 +16,7 @@ The `ContentTranslatedName` Sort Clause isn't available in [Repository filtering ## Example -``` php +``` php skip-validation $query = new LocationQuery(); $query->sortClauses = [new SortClause\ContentTranslatedName()]; ``` diff --git a/docs/search/sort_clause_reference/contenttypename_sort_clause.md b/docs/search/sort_clause_reference/contenttypename_sort_clause.md index fc4c516ae2..369349f5b6 100644 --- a/docs/search/sort_clause_reference/contenttypename_sort_clause.md +++ b/docs/search/sort_clause_reference/contenttypename_sort_clause.md @@ -12,7 +12,7 @@ The [`ContentTypeName` Sort Clause](/api/php_api/php_api_reference/classes/Ibexa ## Example -``` php +``` php skip-validation $query = new Query(); $query->sortClauses = [new SortClause\Trash\ContentTypeName()]; ``` diff --git a/docs/search/sort_clause_reference/createdat_sort_clause.md b/docs/search/sort_clause_reference/createdat_sort_clause.md index 2ef171dc82..22527fa30b 100644 --- a/docs/search/sort_clause_reference/createdat_sort_clause.md +++ b/docs/search/sort_clause_reference/createdat_sort_clause.md @@ -12,7 +12,7 @@ The `CreatedAt` Sort Clause sorts search results by the date and time of the cre ## Example -``` php +``` php skip-validation $productQuery = new ProductQuery( null, null, diff --git a/docs/search/sort_clause_reference/customfield_sort_clause.md b/docs/search/sort_clause_reference/customfield_sort_clause.md index 7770198082..3943898699 100644 --- a/docs/search/sort_clause_reference/customfield_sort_clause.md +++ b/docs/search/sort_clause_reference/customfield_sort_clause.md @@ -22,7 +22,7 @@ The `CustomField` Sort Clause isn't available in [Repository filtering](search_a ## Example -``` php +``` php skip-validation $query = new LocationQuery(); $query->sortClauses = [new SortClause\CustomField('my_custom_field_s')]; ``` diff --git a/docs/search/sort_clause_reference/customprice_sort_clause.md b/docs/search/sort_clause_reference/customprice_sort_clause.md index e042a16adb..4345b03ff2 100644 --- a/docs/search/sort_clause_reference/customprice_sort_clause.md +++ b/docs/search/sort_clause_reference/customprice_sort_clause.md @@ -19,7 +19,7 @@ The `CustomPrice` Sort Clause isn't available in the Legacy Search engine. ## Example -``` php +``` php skip-validation $sortClauses = [ new \Ibexa\Contracts\ProductCatalog\Values\Product\Query\SortClause\CustomPrice( $currency, diff --git a/docs/search/sort_clause_reference/datemodified_sort_clause.md b/docs/search/sort_clause_reference/datemodified_sort_clause.md index a26a1f3749..62c984e20e 100644 --- a/docs/search/sort_clause_reference/datemodified_sort_clause.md +++ b/docs/search/sort_clause_reference/datemodified_sort_clause.md @@ -12,7 +12,7 @@ The [`DateModified` Sort Clause](/api/php_api/php_api_reference/classes/Ibexa-Co ## Example -``` php +``` php skip-validation $query = new LocationQuery(); $query->sortClauses = [new SortClause\DateModified()]; ``` diff --git a/docs/search/sort_clause_reference/datepublished_sort_clause.md b/docs/search/sort_clause_reference/datepublished_sort_clause.md index 39c6bc4f1c..b3024f64a7 100644 --- a/docs/search/sort_clause_reference/datepublished_sort_clause.md +++ b/docs/search/sort_clause_reference/datepublished_sort_clause.md @@ -12,7 +12,7 @@ The [`DatePublished` Sort Clause](/api/php_api/php_api_reference/classes/Ibexa-C ## Example -``` php +``` php skip-validation $query = new LocationQuery(); $query->sortClauses = [new SortClause\DatePublished()]; ``` diff --git a/docs/search/sort_clause_reference/datetrashed_sort_clause.md b/docs/search/sort_clause_reference/datetrashed_sort_clause.md index e82baf72c4..0a5ca94a3f 100644 --- a/docs/search/sort_clause_reference/datetrashed_sort_clause.md +++ b/docs/search/sort_clause_reference/datetrashed_sort_clause.md @@ -12,7 +12,7 @@ The [`DateTrashed` Sort Clause](/api/php_api/php_api_reference/classes/Ibexa-Con ## Example -``` php +``` php skip-validation $query = new Query(); $query->sortClauses = [new SortClause\Trash\DateTrashed()]; ``` diff --git a/docs/search/sort_clause_reference/depth_sort_clause.md b/docs/search/sort_clause_reference/depth_sort_clause.md index 78a0e8f45a..d64a6dbfb8 100644 --- a/docs/search/sort_clause_reference/depth_sort_clause.md +++ b/docs/search/sort_clause_reference/depth_sort_clause.md @@ -12,7 +12,7 @@ The [`Location\Depth` Sort Clause](/api/php_api/php_api_reference/classes/Ibexa- ## Example -``` php +``` php skip-validation $query = new LocationQuery(); $query->sortClauses = [new SortClause\Depth()]; ``` diff --git a/docs/search/sort_clause_reference/field_sort_clause.md b/docs/search/sort_clause_reference/field_sort_clause.md index 5db7bf10c5..d04732af08 100644 --- a/docs/search/sort_clause_reference/field_sort_clause.md +++ b/docs/search/sort_clause_reference/field_sort_clause.md @@ -20,7 +20,7 @@ The `Field` Sort Clause isn't available in [Repository filtering](search_api.md# ## Example -``` php +``` php skip-validation $query = new LocationQuery(); $query->sortClauses = [new SortClause\Field('article', 'title')]; ``` diff --git a/docs/search/sort_clause_reference/id_sort_clause.md b/docs/search/sort_clause_reference/id_sort_clause.md index 1e869ae5a3..10adc3f361 100644 --- a/docs/search/sort_clause_reference/id_sort_clause.md +++ b/docs/search/sort_clause_reference/id_sort_clause.md @@ -12,7 +12,7 @@ The [`Location\Id` Sort Clause](/api/php_api/php_api_reference/classes/Ibexa-Con ## Example -``` php +``` php skip-validation $query = new LocationQuery(); $query->sortClauses = [new SortClause\Location\Id()]; ``` diff --git a/docs/search/sort_clause_reference/ismainlocation_sort_clause.md b/docs/search/sort_clause_reference/ismainlocation_sort_clause.md index ef8f5bed55..2e56eed042 100644 --- a/docs/search/sort_clause_reference/ismainlocation_sort_clause.md +++ b/docs/search/sort_clause_reference/ismainlocation_sort_clause.md @@ -18,7 +18,7 @@ The `Location\IsMainLocation` Sort Clause isn't available in [Repository filteri ## Example -``` php +``` php skip-validation $query = new LocationQuery(); $query->sortClauses = [new SortClause\Location\InMainLocation()]; ``` diff --git a/docs/search/sort_clause_reference/maplocationdistance_sort_clause.md b/docs/search/sort_clause_reference/maplocationdistance_sort_clause.md index c13e240bb1..2cf0cb2503 100644 --- a/docs/search/sort_clause_reference/maplocationdistance_sort_clause.md +++ b/docs/search/sort_clause_reference/maplocationdistance_sort_clause.md @@ -19,7 +19,7 @@ The `MapLocationDistance` Sort Clause isn't available in [Repository filtering]( ## Example -``` php +``` php skip-validation $query = new LocationQuery(); $query->sortClauses = [new SortClause\MapLocationDistance('place', 'location', 49.542889, 20.111349)]; ``` diff --git a/docs/search/sort_clause_reference/order_created_sort_clause.md b/docs/search/sort_clause_reference/order_created_sort_clause.md index c11efc7e38..81cde04e76 100644 --- a/docs/search/sort_clause_reference/order_created_sort_clause.md +++ b/docs/search/sort_clause_reference/order_created_sort_clause.md @@ -13,7 +13,7 @@ The `Created` Sort Clause sorts search results by the date and time when the ord ## Example -``` php +``` php skip-validation $orderQuery = new OrderQuery( $criteria, [ diff --git a/docs/search/sort_clause_reference/order_id_sort_clause.md b/docs/search/sort_clause_reference/order_id_sort_clause.md index 2df732073d..a5bc133c9e 100644 --- a/docs/search/sort_clause_reference/order_id_sort_clause.md +++ b/docs/search/sort_clause_reference/order_id_sort_clause.md @@ -13,7 +13,7 @@ The `Id` Sort Clause sorts search results by order Id. ## Example -``` php +``` php skip-validation $orderQuery = new OrderQuery( $criteria, [ diff --git a/docs/search/sort_clause_reference/order_status_sort_clause.md b/docs/search/sort_clause_reference/order_status_sort_clause.md index e9711c752e..df6df20a2e 100644 --- a/docs/search/sort_clause_reference/order_status_sort_clause.md +++ b/docs/search/sort_clause_reference/order_status_sort_clause.md @@ -13,7 +13,7 @@ The `Status` Sort Clause sorts search results by order status. ## Example -``` php +``` php skip-validation $orderQuery = new OrderQuery( $criteria, [ diff --git a/docs/search/sort_clause_reference/order_updated_sort_clause.md b/docs/search/sort_clause_reference/order_updated_sort_clause.md index 9a17f8f2b3..569dba23d7 100644 --- a/docs/search/sort_clause_reference/order_updated_sort_clause.md +++ b/docs/search/sort_clause_reference/order_updated_sort_clause.md @@ -13,7 +13,7 @@ The `Updated` Sort Clause sorts search results by the date and time when order s ## Example -``` php +``` php skip-validation $orderQuery = new OrderQuery( $criteria, [ diff --git a/docs/search/sort_clause_reference/path_sort_clause.md b/docs/search/sort_clause_reference/path_sort_clause.md index 26937e643f..b1066be706 100644 --- a/docs/search/sort_clause_reference/path_sort_clause.md +++ b/docs/search/sort_clause_reference/path_sort_clause.md @@ -16,7 +16,7 @@ The [`Location\Path` Sort Clause](/api/php_api/php_api_reference/classes/Ibexa-C ## Example -``` php +``` php skip-validation $query = new LocationQuery(); $query->sortClauses = [new SortClause\Location\Path()]; ``` diff --git a/docs/search/sort_clause_reference/payment_createdat_sort_clause.md b/docs/search/sort_clause_reference/payment_createdat_sort_clause.md index c8c82ffec6..4143c9b7a4 100644 --- a/docs/search/sort_clause_reference/payment_createdat_sort_clause.md +++ b/docs/search/sort_clause_reference/payment_createdat_sort_clause.md @@ -13,7 +13,7 @@ The `CreatedAt` Sort Clause sorts search results by the date and time when the p ## Example -``` php +``` php skip-validation $paymentQuery = new PaymentQuery( $criteria, [ diff --git a/docs/search/sort_clause_reference/payment_id_sort_clause.md b/docs/search/sort_clause_reference/payment_id_sort_clause.md index 441cbd2edb..77884cb356 100644 --- a/docs/search/sort_clause_reference/payment_id_sort_clause.md +++ b/docs/search/sort_clause_reference/payment_id_sort_clause.md @@ -13,7 +13,7 @@ The `Id` Sort Clause sorts search results by payment ID. ## Example -``` php +``` php skip-validation $paymentQuery = new PaymentQuery( $criteria, [ diff --git a/docs/search/sort_clause_reference/payment_identifier_sort_clause.md b/docs/search/sort_clause_reference/payment_identifier_sort_clause.md index c8969c7f5e..e3a663838f 100644 --- a/docs/search/sort_clause_reference/payment_identifier_sort_clause.md +++ b/docs/search/sort_clause_reference/payment_identifier_sort_clause.md @@ -13,7 +13,7 @@ The `Identifier` Sort Clause sorts search results by payment identifier. ## Example -``` php +``` php skip-validation $paymentQuery = new PaymentQuery( $criteria, [ diff --git a/docs/search/sort_clause_reference/payment_method_createdat_sort_clause.md b/docs/search/sort_clause_reference/payment_method_createdat_sort_clause.md index f89ad0c7d6..50ee7c966f 100644 --- a/docs/search/sort_clause_reference/payment_method_createdat_sort_clause.md +++ b/docs/search/sort_clause_reference/payment_method_createdat_sort_clause.md @@ -13,7 +13,7 @@ The `CreatedAt` Sort Clause sorts search results by the date and time when the p ## Example -``` php +``` php skip-validation $paymentMethodQuery = new PaymentMethodQuery( $criteria, [ diff --git a/docs/search/sort_clause_reference/payment_method_enabled_sort_clause.md b/docs/search/sort_clause_reference/payment_method_enabled_sort_clause.md index 5c3a20df97..a414e7962a 100644 --- a/docs/search/sort_clause_reference/payment_method_enabled_sort_clause.md +++ b/docs/search/sort_clause_reference/payment_method_enabled_sort_clause.md @@ -13,7 +13,7 @@ The `Enabled` Sort Clause sorts search results by payment method status. ## Example -``` php +``` php skip-validation $paymentMethodQuery = new PaymentMethodQuery( $criteria, [ diff --git a/docs/search/sort_clause_reference/payment_method_id_sort_clause.md b/docs/search/sort_clause_reference/payment_method_id_sort_clause.md index bd7bc8e50a..9189617102 100644 --- a/docs/search/sort_clause_reference/payment_method_id_sort_clause.md +++ b/docs/search/sort_clause_reference/payment_method_id_sort_clause.md @@ -13,7 +13,7 @@ The `Id` Sort Clause sorts search results by payment method ID. ## Example -``` php +``` php skip-validation $paymentMethodQuery = new PaymentMethodQuery( $criteria, [ diff --git a/docs/search/sort_clause_reference/payment_method_identifier_sort_clause.md b/docs/search/sort_clause_reference/payment_method_identifier_sort_clause.md index 02fa6e64d6..941d4b98fe 100644 --- a/docs/search/sort_clause_reference/payment_method_identifier_sort_clause.md +++ b/docs/search/sort_clause_reference/payment_method_identifier_sort_clause.md @@ -13,7 +13,7 @@ The `Identifier` Sort Clause sorts search results by payment method identifier. ## Example -``` php +``` php skip-validation $paymentMethodQuery = new PaymentMethodQuery( $criteria, [ diff --git a/docs/search/sort_clause_reference/payment_method_updatedat_sort_clause.md b/docs/search/sort_clause_reference/payment_method_updatedat_sort_clause.md index 4c20548949..9c911d7a70 100644 --- a/docs/search/sort_clause_reference/payment_method_updatedat_sort_clause.md +++ b/docs/search/sort_clause_reference/payment_method_updatedat_sort_clause.md @@ -13,7 +13,7 @@ The `UpdatedAt` Sort Clause sorts search results by the date and time when payme ## Example -``` php +``` php skip-validation $paymentMethodQuery = new PaymentMethodQuery( $criteria, [ diff --git a/docs/search/sort_clause_reference/payment_status_sort_clause.md b/docs/search/sort_clause_reference/payment_status_sort_clause.md index ea4afc15bf..8952f4b659 100644 --- a/docs/search/sort_clause_reference/payment_status_sort_clause.md +++ b/docs/search/sort_clause_reference/payment_status_sort_clause.md @@ -13,7 +13,7 @@ The `Status` Sort Clause sorts search results by payment status. ## Example -``` php +``` php skip-validation $paymentQuery = new PaymentQuery( $criteria, [ diff --git a/docs/search/sort_clause_reference/payment_updatedat_sort_clause.md b/docs/search/sort_clause_reference/payment_updatedat_sort_clause.md index 82a65ab0a9..014b04762e 100644 --- a/docs/search/sort_clause_reference/payment_updatedat_sort_clause.md +++ b/docs/search/sort_clause_reference/payment_updatedat_sort_clause.md @@ -13,7 +13,7 @@ The `UpdatedAt` Sort Clause sorts search results by the date and time when payme ## Example -``` php +``` php skip-validation $paymentQuery = new PaymentQuery( $criteria, [ diff --git a/docs/search/sort_clause_reference/priority_sort_clause.md b/docs/search/sort_clause_reference/priority_sort_clause.md index 874bb8f919..6f5bd928ad 100644 --- a/docs/search/sort_clause_reference/priority_sort_clause.md +++ b/docs/search/sort_clause_reference/priority_sort_clause.md @@ -12,7 +12,7 @@ The [`Location\Priority` Sort Clause](/api/php_api/php_api_reference/classes/Ibe ## Example -``` php +``` php skip-validation $query = new LocationQuery(); $query->sortClauses = [new SortClause\Location\Priority()]; ``` diff --git a/docs/search/sort_clause_reference/productavailability_sort_clause.md b/docs/search/sort_clause_reference/productavailability_sort_clause.md index 4129785d5a..50caf66adb 100644 --- a/docs/search/sort_clause_reference/productavailability_sort_clause.md +++ b/docs/search/sort_clause_reference/productavailability_sort_clause.md @@ -12,7 +12,7 @@ The `ProductAvailability` Sort Clause sorts search results by whether they have ## Example -``` php +``` php skip-validation $query = new ProductQuery( null, null, diff --git a/docs/search/sort_clause_reference/productcode_sort_clause.md b/docs/search/sort_clause_reference/productcode_sort_clause.md index 4eed6ce992..31273329db 100644 --- a/docs/search/sort_clause_reference/productcode_sort_clause.md +++ b/docs/search/sort_clause_reference/productcode_sort_clause.md @@ -12,7 +12,7 @@ The `ProductCode` Sort Clause sorts search results by the product code. ## Example -``` php +``` php skip-validation $query = new ProductQuery( null, null, diff --git a/docs/search/sort_clause_reference/productname_sort_clause.md b/docs/search/sort_clause_reference/productname_sort_clause.md index 4321cff756..5bd6adaf6d 100644 --- a/docs/search/sort_clause_reference/productname_sort_clause.md +++ b/docs/search/sort_clause_reference/productname_sort_clause.md @@ -12,7 +12,7 @@ The `ProductName` Sort Clause sorts search results by the Product code. ## Example -``` php +``` php skip-validation $query = new ProductQuery( null, null, diff --git a/docs/search/sort_clause_reference/random_sort_clause.md b/docs/search/sort_clause_reference/random_sort_clause.md index 2c83038981..a9a2c66956 100644 --- a/docs/search/sort_clause_reference/random_sort_clause.md +++ b/docs/search/sort_clause_reference/random_sort_clause.md @@ -18,7 +18,7 @@ In Elasticsearch engine, you cannot combine the `Random` Sort Clause with any ot ## Example -``` php +``` php skip-validation $query = new LocationQuery(); $query->sortClauses = [new SortClause\Random()]; ``` diff --git a/docs/search/sort_clause_reference/score_sort_clause.md b/docs/search/sort_clause_reference/score_sort_clause.md index 87bb7f49c7..b5176eaf1a 100644 --- a/docs/search/sort_clause_reference/score_sort_clause.md +++ b/docs/search/sort_clause_reference/score_sort_clause.md @@ -16,7 +16,7 @@ The `Score` Sort Clause isn't available in [Repository filtering](search_api.md# ## Example -``` php +``` php skip-validation $query = new LocationQuery(); $query->sortClauses = [new SortClause\Score()]; ``` diff --git a/docs/search/sort_clause_reference/sectionidentifier_sort_clause.md b/docs/search/sort_clause_reference/sectionidentifier_sort_clause.md index 5999554176..1685b4c9e7 100644 --- a/docs/search/sort_clause_reference/sectionidentifier_sort_clause.md +++ b/docs/search/sort_clause_reference/sectionidentifier_sort_clause.md @@ -16,7 +16,7 @@ The [`SectionIdentifier` Sort Clause](/api/php_api/php_api_reference/classes/Ibe ## Example -``` php +``` php skip-validation $query = new LocationQuery(); $query->sortClauses = [new SortClause\SectionIdentifier()]; ``` diff --git a/docs/search/sort_clause_reference/sectionname_sort_clause.md b/docs/search/sort_clause_reference/sectionname_sort_clause.md index 950df555e2..0d8dd606ac 100644 --- a/docs/search/sort_clause_reference/sectionname_sort_clause.md +++ b/docs/search/sort_clause_reference/sectionname_sort_clause.md @@ -12,7 +12,7 @@ The [`SectionName` Sort Clause](/api/php_api/php_api_reference/classes/Ibexa-Con ## Example -``` php +``` php skip-validation $query = new LocationQuery(); $query->sortClauses = [new SortClause\SectionName()]; ``` diff --git a/docs/search/sort_clause_reference/shipment_createdat_sort_clause.md b/docs/search/sort_clause_reference/shipment_createdat_sort_clause.md index 373aeb5d9e..226a87e099 100644 --- a/docs/search/sort_clause_reference/shipment_createdat_sort_clause.md +++ b/docs/search/sort_clause_reference/shipment_createdat_sort_clause.md @@ -13,7 +13,7 @@ The `CreatedAt` Sort Clause sorts search results by the date and time when the s ## Example -``` php +``` php skip-validation $shipmentQuery = new ShipmentQuery( $criteria, [ diff --git a/docs/search/sort_clause_reference/shipment_id_sort_clause.md b/docs/search/sort_clause_reference/shipment_id_sort_clause.md index fa405de54e..aeda0e48cb 100644 --- a/docs/search/sort_clause_reference/shipment_id_sort_clause.md +++ b/docs/search/sort_clause_reference/shipment_id_sort_clause.md @@ -13,7 +13,7 @@ The `Id` Sort Clause sorts search results by shipment Id. ## Example -``` php +``` php skip-validation $shipmentQuery = new ShipmentQuery( $criteria, [ diff --git a/docs/search/sort_clause_reference/shipment_identifier_sort_clause.md b/docs/search/sort_clause_reference/shipment_identifier_sort_clause.md index 1bc1a60bf3..45ed4b7e8c 100644 --- a/docs/search/sort_clause_reference/shipment_identifier_sort_clause.md +++ b/docs/search/sort_clause_reference/shipment_identifier_sort_clause.md @@ -13,7 +13,7 @@ The `Identifier` Sort Clause sorts search results by shipment identifier. ## Example -``` php +``` php skip-validation $shipmentQuery = new ShipmentQuery( $criteria, [ diff --git a/docs/search/sort_clause_reference/shipment_status_sort_clause.md b/docs/search/sort_clause_reference/shipment_status_sort_clause.md index 5a0cacf07b..0d3f577f21 100644 --- a/docs/search/sort_clause_reference/shipment_status_sort_clause.md +++ b/docs/search/sort_clause_reference/shipment_status_sort_clause.md @@ -13,7 +13,7 @@ The `Status` Sort Clause sorts search results by shipment status. ## Example -``` php +``` php skip-validation $shipmentQuery = new ShipmentQuery( $criteria, [ diff --git a/docs/search/sort_clause_reference/shipment_updatedat_sort_clause.md b/docs/search/sort_clause_reference/shipment_updatedat_sort_clause.md index 0b6260a8ed..5644d0f24b 100644 --- a/docs/search/sort_clause_reference/shipment_updatedat_sort_clause.md +++ b/docs/search/sort_clause_reference/shipment_updatedat_sort_clause.md @@ -13,7 +13,7 @@ The `UpdatedAt` Sort Clause sorts search results by the date and time when shipm ## Example -``` php +``` php skip-validation $shipmentQuery = new ShipmentQuery( $criteria, [ diff --git a/docs/search/sort_clause_reference/userlogin_sort_clause.md b/docs/search/sort_clause_reference/userlogin_sort_clause.md index f234780543..5fa5d156e9 100644 --- a/docs/search/sort_clause_reference/userlogin_sort_clause.md +++ b/docs/search/sort_clause_reference/userlogin_sort_clause.md @@ -12,7 +12,7 @@ The [`UserLogin` Sort Clause](/api/php_api/php_api_reference/classes/Ibexa-Contr ## Example -``` php +``` php skip-validation $query = new Query(); $query->sortClauses = [new SortClause\Trash\UserLogin()]; ``` diff --git a/docs/search/sort_clause_reference/visibility_sort_clause.md b/docs/search/sort_clause_reference/visibility_sort_clause.md index 258ee5fb72..551a814cc8 100644 --- a/docs/search/sort_clause_reference/visibility_sort_clause.md +++ b/docs/search/sort_clause_reference/visibility_sort_clause.md @@ -14,7 +14,7 @@ Locations that aren't visible are ranked as higher values (for example, with asc ## Example -``` php +``` php skip-validation $query = new LocationQuery(); $query->sortClauses = [new SortClause\Location\Visibility()]; ``` diff --git a/docs/search/url_search_reference/id_url_sort_clause.md b/docs/search/url_search_reference/id_url_sort_clause.md index ba2420079e..ef18c6edb5 100644 --- a/docs/search/url_search_reference/id_url_sort_clause.md +++ b/docs/search/url_search_reference/id_url_sort_clause.md @@ -12,7 +12,7 @@ The [`SortClause\Id` Sort Clause](/api/php_api/php_api_reference/classes/Ibexa-C ## Example -``` php +``` php skip-validation use Ibexa\Contracts\Core\Repository\Values\URL\URLQuery; use Ibexa\Contracts\Core\Repository\Values\URL\Query\SortClause; diff --git a/docs/search/url_search_reference/logicaland_url_criterion.md b/docs/search/url_search_reference/logicaland_url_criterion.md index f7b77a1649..914a1e7833 100644 --- a/docs/search/url_search_reference/logicaland_url_criterion.md +++ b/docs/search/url_search_reference/logicaland_url_criterion.md @@ -12,7 +12,7 @@ The [`LogicalAnd` URL Criterion](/api/php_api/php_api_reference/classes/Ibexa-Co ## Example -``` php +``` php skip-validation $query->filter = new Criterion\LogicalAnd( [ new Criterion\Validity(true), diff --git a/docs/search/url_search_reference/logicalnot_url_criterion.md b/docs/search/url_search_reference/logicalnot_url_criterion.md index 6222fad435..c526c06c74 100644 --- a/docs/search/url_search_reference/logicalnot_url_criterion.md +++ b/docs/search/url_search_reference/logicalnot_url_criterion.md @@ -14,7 +14,7 @@ It takes only one Criterion in the array parameter. ## Example -``` php +``` php skip-validation $query->filter = new Criterion\LogicalNot( new Criterion\Pattern('ibexa.co') ); diff --git a/docs/search/url_search_reference/logicalor_url_criterion.md b/docs/search/url_search_reference/logicalor_url_criterion.md index 7e79da7f1f..f3eef56e9c 100644 --- a/docs/search/url_search_reference/logicalor_url_criterion.md +++ b/docs/search/url_search_reference/logicalor_url_criterion.md @@ -12,7 +12,7 @@ The [`LogicalOr` URL Criterion](/api/php_api/php_api_reference/classes/Ibexa-Con ## Example -``` php +``` php skip-validation $query->filter = new Criterion\LogicalOr( [ new Criterion\SectionIdentifier(['sports', 'news']), diff --git a/docs/search/url_search_reference/pattern_url_criterion.md b/docs/search/url_search_reference/pattern_url_criterion.md index 34ed0afb67..a7c8d75e65 100644 --- a/docs/search/url_search_reference/pattern_url_criterion.md +++ b/docs/search/url_search_reference/pattern_url_criterion.md @@ -12,6 +12,6 @@ The [`Pattern` URL Criterion](/api/php_api/php_api_reference/classes/Ibexa-Contr ## Example -``` php +``` php skip-validation $query->filter = new Criterion\Pattern('ibexa.co'); ``` diff --git a/docs/search/url_search_reference/sectionid_url_criterion.md b/docs/search/url_search_reference/sectionid_url_criterion.md index 8c0a67f03b..882a933915 100644 --- a/docs/search/url_search_reference/sectionid_url_criterion.md +++ b/docs/search/url_search_reference/sectionid_url_criterion.md @@ -12,6 +12,6 @@ The [`SectionId` URL Criterion](/api/php_api/php_api_reference/classes/Ibexa-Con ## Example -``` php +``` php skip-validation $query->filter = new Criterion\SectionId(['1', '3']); ``` diff --git a/docs/search/url_search_reference/sectionidentifier_url_criterion.md b/docs/search/url_search_reference/sectionidentifier_url_criterion.md index e0069e6287..e3131ffb86 100644 --- a/docs/search/url_search_reference/sectionidentifier_url_criterion.md +++ b/docs/search/url_search_reference/sectionidentifier_url_criterion.md @@ -12,6 +12,6 @@ The [SectionIdentifier URL Criterion](/api/php_api/php_api_reference/classes/Ibe ## Example -```php +```php skip-validation $query->filter = new Criterion\SectionIdentifier(['standard', 'media']); ``` diff --git a/docs/search/url_search_reference/url_url_sort_clause.md b/docs/search/url_search_reference/url_url_sort_clause.md index 100e56354a..7743649d51 100644 --- a/docs/search/url_search_reference/url_url_sort_clause.md +++ b/docs/search/url_search_reference/url_url_sort_clause.md @@ -12,7 +12,7 @@ The [`SortClause\Url` Sort Clause](/api/php_api/php_api_reference/classes/Ibexa- ## Example -``` php +``` php skip-validation use Ibexa\Contracts\Core\Repository\Values\URL\URLQuery; use Ibexa\Contracts\Core\Repository\Values\URL\Query\SortClause; diff --git a/docs/search/url_search_reference/validity_url_criterion.md b/docs/search/url_search_reference/validity_url_criterion.md index 89b637d604..f114b0efd8 100644 --- a/docs/search/url_search_reference/validity_url_criterion.md +++ b/docs/search/url_search_reference/validity_url_criterion.md @@ -12,6 +12,6 @@ The [Validity URL Criterion](/api/php_api/php_api_reference/classes/Ibexa-Contra ## Example -```php +```php skip-validation $query->filter = new Criterion\Validity(true); ``` diff --git a/docs/snippets/search_term_aggregation_settings.md b/docs/snippets/search_term_aggregation_settings.md index e67da0f71d..873c062308 100644 --- a/docs/snippets/search_term_aggregation_settings.md +++ b/docs/snippets/search_term_aggregation_settings.md @@ -3,7 +3,7 @@ You can define additional limits to the results using the `setLimit()` and `setMinCount()` methods. The following example limits the number of terms returned to 5 and only considers terms that have 10 or more results: -``` php +``` php skip-validation $aggregation = new //... $aggregation->setLimit(5); $aggregation->setMinCount(10); diff --git a/docs/templating/layout/add_login_form.md b/docs/templating/layout/add_login_form.md index d035abf03e..59b88c10db 100644 --- a/docs/templating/layout/add_login_form.md +++ b/docs/templating/layout/add_login_form.md @@ -56,7 +56,7 @@ You can use a custom template for example to display information about password In case of more advanced template customization, you can use a subscriber, for example in `src/EventSubscriber/LoginFormViewSubscriber.php`: -``` php hl_lines="23 35 40 42" +``` php skip-validation hl_lines="23 35 40 42" getMethod() != REQUEST::METHOD_POST) { throw new NotFoundHttpException(); } diff --git a/docs/tutorials/beginner_tutorial/5_display_a_list_of_content_items.md b/docs/tutorials/beginner_tutorial/5_display_a_list_of_content_items.md index 6ddef06e21..0d8bd69e29 100644 --- a/docs/tutorials/beginner_tutorial/5_display_a_list_of_content_items.md +++ b/docs/tutorials/beginner_tutorial/5_display_a_list_of_content_items.md @@ -57,7 +57,7 @@ For more information, see [Built-In Query Types](built-in_query_types.md). Here, you need to display `ride` objects that have been published (are visible). Create a `RideQueryType.php` file in `src/QueryType`: -``` php hl_lines="21 22" +``` php skip-validation hl_lines="21 22"
{% if zones[0].blocks %} @@ -197,7 +197,7 @@ defined in the [Enterprise Beginner tutorial](page_and_form_tutorial.md) `src/AppBundle/Block/RandomBlock.php`: - ``` php + ``` php skip-validation
{% if zones[0].blocks %} @@ -456,7 +456,7 @@ defined in the [Enterprise Beginner tutorial](page_and_form_tutorial.md) `src/AppBundle/Block/Event/Listener/RandomBlockListener.php` in place of `src/AppBundle/Block/RandomBlock.php`: - ``` php + ``` php skip-validation ['all' => true], Ibexa\Bundle\Checkout\IbexaCheckoutBundle::class => ['all' => true], Ibexa\Bundle\Storefront\IbexaStorefrontBundle::class => ['all' => true], diff --git a/docs/update_and_migration/from_4.6/update_from_4.6.md b/docs/update_and_migration/from_4.6/update_from_4.6.md index 1aadddff0c..6abd1b6f8b 100644 --- a/docs/update_and_migration/from_4.6/update_from_4.6.md +++ b/docs/update_and_migration/from_4.6/update_from_4.6.md @@ -161,7 +161,7 @@ merge with your custom settings if needed, and commit them to Git. If the new bundle `ibexa/core-search` has not been added by the recipes, enable it by adding the following line in `config/bundles.php`: -```php +```php skip-validation Ibexa\Bundle\CoreSearch\IbexaCoreSearchBundle::class => ['all' => true], ``` diff --git a/docs/update_and_migration/from_4.6/update_to_5.0.md b/docs/update_and_migration/from_4.6/update_to_5.0.md index 0b9c561ce6..cd03a8f32c 100644 --- a/docs/update_and_migration/from_4.6/update_to_5.0.md +++ b/docs/update_and_migration/from_4.6/update_to_5.0.md @@ -50,7 +50,7 @@ It's recommended to activate one rule set at a time and preview the output by ru Your configuration could look like the following example: -```php +```php skip-validation return RectorConfig::configure() ->withPaths( [ @@ -461,7 +461,7 @@ Again, it's recommended to activate one rule set at a time and preview the outpu As this update spans across a broad range of versions, multiple rules can be considered as in the example below. -```php +```php skip-validation //… use Rector\Symfony\Set\SymfonySetList; use Rector\Symfony\Set\SensiolabsSetList; diff --git a/docs/update_and_migration/migrate_to_ibexa_dxp/migrating_from_ez_publish_platform.md b/docs/update_and_migration/migrate_to_ibexa_dxp/migrating_from_ez_publish_platform.md index c90101af41..a489352eae 100644 --- a/docs/update_and_migration/migrate_to_ibexa_dxp/migrating_from_ez_publish_platform.md +++ b/docs/update_and_migration/migrate_to_ibexa_dxp/migrating_from_ez_publish_platform.md @@ -582,7 +582,7 @@ To use the script, do the following: **2.** Add `ezflow-migration-toolkit` to `AppKernel.php`. -``` php +``` php skip-validation // AppKernel.php new EzSystems\EzFlowMigrationToolkitBundle\EzSystemsEzFlowMigrationToolkitBundle() ``` @@ -618,7 +618,7 @@ You can see a report summarizing the results of the migration. **6.** Add `MigrationBundle` to `AppKernel.php`. -``` php +``` php skip-validation // AppKernel.php new MigrationBundle\MigrationBundle() ``` diff --git a/docs/users/oauth_server.md b/docs/users/oauth_server.md index bc12a9889f..3d2d26885f 100644 --- a/docs/users/oauth_server.md +++ b/docs/users/oauth_server.md @@ -34,7 +34,7 @@ Add the tables needed by the bundle: Then, in `config/bundles.php`, at the end of an array with a list of bundles, add the following two lines : -```php +```php skip-validation segmentationService->removeSegmentGroup($group); ``` diff --git a/docs/users/user_authentication.md b/docs/users/user_authentication.md index 9ec9e79c5d..e408715b22 100644 --- a/docs/users/user_authentication.md +++ b/docs/users/user_authentication.md @@ -71,7 +71,7 @@ services: Don't mix `MVCEvents::INTERACTIVE_LOGIN` event (specific to [[= product_name =]]) and `SecurityEvents::INTERACTIVE_LOGIN` event (fired by Symfony security component). -``` php +``` php skip-validation extractor = new MarkdownExtractor('php'); + $this->writer = new InlinePhpWriter(); + $this->syncer = new InlinePhpSyncer(); + } + + // ------------------------------------------------------------------------- + // Helpers + // ------------------------------------------------------------------------- + + /** + * Runs the full pipeline for the first block found in $md. + * + * @param array $fixerReplacements str_replace()-style substitutions applied + * to the built file content to simulate cs-fixer. + * + * @return string|null Updated Markdown, or null when the pipeline produced no change. + */ + private function pipeline(string $md, array $fixerReplacements = []): ?string + { + $blocks = iterator_to_array($this->extractor->extract($md)); + self::assertNotEmpty($blocks, 'No PHP blocks found in Markdown'); + + $block = $blocks[0]; + $phpFile = $this->writer->build('docs/test.md', $block['line'], $block['body']); + + if ($fixerReplacements !== []) { + $phpFile = strtr($phpFile, $fixerReplacements); + } + + return $this->syncer->sync($phpFile, $md); + } + + /** + * Runs the pipeline for ALL blocks in $md, applying the same fixer replacements to each, + * and patches the Markdown accumulating all changes (highest line first, as the real + * script does). + * + * @param array $fixerReplacements + */ + private function pipelineAll(string $md, array $fixerReplacements = []): string + { + $blocks = iterator_to_array($this->extractor->extract($md)); + self::assertNotEmpty($blocks); + + // Collect per-block PHP files and sort by descending line (highest first). + $items = array_map( + fn (array $block): array => [ + 'line' => $block['line'], + 'phpFile' => strtr( + $this->writer->build('docs/test.md', $block['line'], $block['body']), + $fixerReplacements, + ), + ], + $blocks, + ); + usort($items, static fn (array $a, array $b): int => $b['line'] <=> $a['line']); + + foreach ($items as ['phpFile' => $phpFile, 'line' => $line]) { + $updated = $this->syncer->sync($phpFile, $md); + if ($updated !== null) { + $md = $updated; + } + } + + return $md; + } + + // ------------------------------------------------------------------------- + // No-op: pipeline returns null when cs-fixer changes nothing + // ------------------------------------------------------------------------- + + public function testNoOpForPlainSnippet(): void + { + $md = "text\n\n```php\n\$x = 1;\n```\n"; + self::assertNull($this->pipeline($md)); + } + + public function testNoOpForSnippetWithPhpTag(): void + { + $md = "text\n\n```php\npipeline($md)); + } + + public function testNoOpForSnippetWithPhpTagAndBlankLine(): void + { + // The blank line between pipeline($md)); + } + + public function testNoOpForIndentedSnippet(): void + { + $md = "!!! note\n\n ```php\n \$x = 1;\n ```\n"; + self::assertNull($this->pipeline($md)); + } + + public function testNoOpForIndentedSnippetWithPhpTagAndBlankLine(): void + { + $md = "!!! note\n\n ```php\n pipeline($md)); + } + + // ------------------------------------------------------------------------- + // Changes are applied correctly + // ------------------------------------------------------------------------- + + public function testChangeAppliedToPlainSnippet(): void + { + $md = "text\n\n```php\n\$x=1;\n```\n"; + $result = $this->pipeline($md, ['$x=1;' => '$x = 1;']); + + self::assertNotNull($result); + self::assertStringContainsString('$x = 1;', $result); + self::assertStringNotContainsString('$x=1;', $result); + } + + public function testChangeAppliedPreservesPhpTag(): void + { + $md = "text\n\n```php\npipeline($md, ['$x=1;' => '$x = 1;']); + + self::assertNotNull($result); + self::assertStringContainsString("pipeline($md, ['$x=1;' => '$x = 1;']); + + self::assertNotNull($result); + self::assertStringContainsString("pipeline($md, ['$x=1;' => '$x = 1;']); + + self::assertNotNull($result); + self::assertStringContainsString(' $x = 1;', $result); + } + + public function testChangeAppliedToIndentedSnippetWithPhpTagAndBlankLine(): void + { + $md = "!!! note\n\n ```php\n pipeline($md, ['$x=1;' => '$x = 1;']); + + self::assertNotNull($result); + self::assertStringContainsString(" pipeline($md, [ + "use B\\Baz;\nuse A\\Bar;" => "use A\\Bar;\nuse B\\Baz;", + ]); + + self::assertNotNull($result); + self::assertStringContainsString("use A\\Bar;\nuse B\\Baz;", $result); + self::assertStringContainsString(" $fixerReplacements + */ + #[DataProvider('provideIdempotencyCases')] + public function testPipelineIsIdempotent(string $md, array $fixerReplacements): void + { + // First pass (may or may not change the Markdown). + $updated = $this->pipeline($md, $fixerReplacements) ?? $md; + + // Second pass: re-extract from the updated Markdown; fixer makes no further changes. + $blocks = iterator_to_array($this->extractor->extract($updated)); + self::assertNotEmpty($blocks); + + $block = $blocks[0]; + $phpFile = $this->writer->build('docs/test.md', $block['line'], $block['body']); + + self::assertNull( + $this->syncer->sync($phpFile, $updated), + 'A second sync after no fixer changes must return null', + ); + } + + /** + * @return iterable}> + */ + public static function provideIdempotencyCases(): iterable + { + yield 'plain snippet, no change' => ["text\n\n```php\n\$x = 1;\n```\n", []]; + yield 'plain snippet, spacing fixed' => ["text\n\n```php\n\$x=1;\n```\n", ['$x=1;' => '$x = 1;']]; + yield ' ["text\n\n```php\n ["text\n\n```php\n '$x = 1;']]; + yield ' ["text\n\n```php\n ["text\n\n```php\n '$x = 1;']]; + yield 'indented, no change' => ["!!! note\n\n ```php\n \$x = 1;\n ```\n", []]; + yield 'indented, spacing fixed' => ["!!! note\n\n ```php\n \$x=1;\n ```\n", ['$x=1;' => '$x = 1;']]; + } + + // ------------------------------------------------------------------------- + // Multiple blocks in the same Markdown file + // ------------------------------------------------------------------------- + + public function testAllBlocksUpdatedInMultiBlockFile(): void + { + $md = implode("\n", [ + 'intro', + '', + '```php', + '$a=1;', + '```', + '', + 'middle', + '', + '```php', + '$b=2;', + '```', + '', + ]); + + $result = $this->pipelineAll($md, ['$a=1;' => '$a = 1;', '$b=2;' => '$b = 2;']); + + self::assertStringContainsString('$a = 1;', $result); + self::assertStringContainsString('$b = 2;', $result); + } + + public function testLaterBlockCorrectAfterEarlierBlockAddsLines(): void + { + // First block gains a line (blank line restored between pipelineAll($md, ['$a=1;' => '$a = 1;', '$b=2;' => '$b = 2;']); + + self::assertStringContainsString('$a = 1;', $result); + // Second block must still be in its own php fence. + self::assertMatchesRegularExpression('/```php\n\$b = 2;\n```/', $result); + } + + public function testMultiBlockIdempotent(): void + { + $md = implode("\n", [ + '```php', + '$a=1;', + '```', + '', + '```php', + '$b=2;', + '```', + '', + ]); + + // First pass with fixer changes. + $updated = $this->pipelineAll($md, ['$a=1;' => '$a = 1;', '$b=2;' => '$b = 2;']); + + // Second pass: no fixer changes — everything should stay the same. + $blocks = iterator_to_array($this->extractor->extract($updated)); + $items = array_map( + fn (array $block): array => [ + 'line' => $block['line'], + 'phpFile' => $this->writer->build('docs/test.md', $block['line'], $block['body']), + ], + $blocks, + ); + usort($items, static fn (array $a, array $b): int => $b['line'] <=> $a['line']); + + foreach ($items as ['phpFile' => $phpFile]) { + self::assertNull( + $this->syncer->sync($phpFile, $updated), + 'No change expected on second pass', + ); + } + } + + // ------------------------------------------------------------------------- + // Surrounding Markdown content is never modified + // ------------------------------------------------------------------------- + + public function testSurroundingMarkdownIsUntouched(): void + { + $md = "# Heading\n\nSome prose.\n\n```php\n\$x=1;\n```\n\nMore prose.\n\n> A blockquote.\n"; + $result = $this->pipeline($md, ['$x=1;' => '$x = 1;']); + + self::assertNotNull($result); + self::assertStringContainsString('# Heading', $result); + self::assertStringContainsString('Some prose.', $result); + self::assertStringContainsString('More prose.', $result); + self::assertStringContainsString('> A blockquote.', $result); + } + + public function testFenceLanguageTagIsPreserved(): void + { + $md = "```php\n\$x=1;\n```\n"; + $result = $this->pipeline($md, ['$x=1;' => '$x = 1;']); + + self::assertNotNull($result); + self::assertStringContainsString('```php', $result); + } + + public function testFenceWithHlLinesAnnotationIsPreserved(): void + { + $md = "```php hl_lines=\"1 2\"\n\$x=1;\n\$y=2;\n```\n"; + $result = $this->pipeline($md, ['$x=1;' => '$x = 1;', '$y=2;' => '$y = 2;']); + + self::assertNotNull($result); + self::assertStringContainsString('```php hl_lines="1 2"', $result); + } +} diff --git a/tests/InlineSamples/InlinePhpSyncer.php b/tests/InlineSamples/InlinePhpSyncer.php new file mode 100644 index 0000000000..69a818c9a6 --- /dev/null +++ b/tests/InlineSamples/InlinePhpSyncer.php @@ -0,0 +1,189 @@ + + * + * + * After php-cs-fixer has reformatted the file, this class maps the changes back: + * 1. Locates the "// Source:" comment to find the original line number. + * 2. Strips the header to recover the reformatted body. + * 3. Restores the $m[1], 'line' => (int) $m[2]]; + } + } + + return null; + } + + /** + * Applies changes from a reformatted _inline_php file back to its source Markdown content. + * + * @return string|null Updated Markdown content, or null if nothing changed or the source + * location cannot be mapped. + */ + public function sync(string $phpFileContent, string $mdContent): ?string + { + $location = $this->parseSourceLocation($phpFileContent); + if ($location === null) { + return null; + } + + $fixedBody = $this->extractBody($phpFileContent); + + return $this->applyToMarkdown($fixedBody, $location['line'], $mdContent); + } + + /** + * Extracts the snippet body from a _inline_php file by stripping the auto-generated header. + * + * The header ends at the first blank line that follows the auto-generated comments. + * The $line) { + if (preg_match('/^\/\/ Source: .+:\d+$/', $line)) { + $sourceIdx = $i; + break; + } + } + + if ($sourceIdx === null) { + return ''; + } + + // Advance past remaining header comment lines to the blank separator. + $cursor = $sourceIdx + 1; + while ($cursor < count($lines) && $lines[$cursor] !== '') { + ++$cursor; + } + ++$cursor; // skip the blank separator itself + + $bodyLines = array_slice($lines, $cursor); + + // cs-fixer ensures a single trailing newline; drop the resulting empty last element. + if (end($bodyLines) === '') { + array_pop($bodyLines); + } + + return implode("\n", $bodyLines); + } + + /** + * Replaces the body of the fenced code block at $bodyLine in $mdContent with $fixedBody. + * + * @param string $fixedBody Reformatted body as stored in the _inline_php file: + * without the = count($mdLines)) { + return null; + } + + // Detect admonition indentation from the opening fence line. + preg_match('/^(?P *)```/', $mdLines[$fenceIdx], $indentMatch); + $indent = $indentMatch['indent'] ?? ''; + + // Locate the closing fence (same indentation prefix + ```). + $closingFence = $indent . '```'; + $closingIdx = null; + for ($i = $bodyStartIdx; $i < count($mdLines); ++$i) { + if ($mdLines[$i] === $closingFence) { + $closingIdx = $i; + break; + } + } + + if ($closingIdx === null) { + return null; + } + + $originalBodyLines = array_slice($mdLines, $bodyStartIdx, $closingIdx - $bodyStartIdx); + + // Detect whether the original snippet opened with $line !== '' ? $indent . $line : $line, + $fixedBodyLines, + ); + $fixedBody = implode("\n", $fixedBodyLines); + } + + if (implode("\n", $originalBodyLines) === $fixedBody) { + return null; + } + + array_splice($mdLines, $bodyStartIdx, $closingIdx - $bodyStartIdx, $fixedBodyLines); + + return implode("\n", $mdLines); + } +} diff --git a/tests/InlineSamples/InlinePhpSyncerTest.php b/tests/InlineSamples/InlinePhpSyncerTest.php new file mode 100644 index 0000000000..3401258687 --- /dev/null +++ b/tests/InlineSamples/InlinePhpSyncerTest.php @@ -0,0 +1,417 @@ +syncer = new InlinePhpSyncer(); + $this->writer = new InlinePhpWriter(); + } + + // ------------------------------------------------------------------------- + // Helpers + // ------------------------------------------------------------------------- + + /** + * Delegates to InlinePhpWriter::build() — the production class — so syncer tests + * always use the canonical file format. + */ + private function buildPhpFile(string $sourcePath, int $bodyLine, string $mdBody): string + { + return $this->writer->build($sourcePath, $bodyLine, $mdBody); + } + + /** + * Returns the 1-based line number of the first body line for the first fenced PHP block + * found in $md, using MarkdownExtractor. + */ + private static function bodyLineOf(string $md): int + { + $extractor = new MarkdownExtractor('php'); + $blocks = iterator_to_array($extractor->extract($md)); + self::assertNotEmpty($blocks, 'No PHP blocks found in Markdown'); + + return $blocks[0]['line']; + } + + // ------------------------------------------------------------------------- + // parseSourceLocation + // ------------------------------------------------------------------------- + + public function testParseSourceLocationReturnsNullWhenCommentMissing(): void + { + $content = "syncer->parseSourceLocation($content)); + } + + public function testParseSourceLocationExtractsPathAndLine(): void + { + $content = $this->buildPhpFile('docs/api/example.md', 42, '$x = 1;'); + $location = $this->syncer->parseSourceLocation($content); + + self::assertNotNull($location); + self::assertSame('docs/api/example.md', $location['path']); + self::assertSame(42, $location['line']); + } + + public function testParseSourceLocationToleratesDeclarationInsertedByFixer(): void + { + // php-cs-fixer may insert declare(strict_types=1) before the source comment. + $content = "syncer->parseSourceLocation($content); + + self::assertNotNull($location); + self::assertSame('docs/foo.md', $location['path']); + self::assertSame(7, $location['line']); + } + + // ------------------------------------------------------------------------- + // sync — no change cases + // ------------------------------------------------------------------------- + + public function testSyncReturnsNullForMissingSourceComment(): void + { + $md = "text\n\n```php\n\$x = 1;\n```\n"; + $phpFile = "syncer->sync($phpFile, $md)); + } + + public function testSyncReturnsNullWhenBodyIsUnchanged(): void + { + $md = "text\n\n```php\n\$x = 1;\n```\n"; + $bodyLine = self::bodyLineOf($md); + $phpFile = $this->buildPhpFile('docs/test.md', $bodyLine, '$x = 1;'); + + self::assertNull($this->syncer->sync($phpFile, $md)); + } + + public function testSyncReturnsNullWhenPhpTagSnippetIsUnchanged(): void + { + $md = "text\n\n```php\nbuildPhpFile('docs/test.md', $bodyLine, "syncer->sync($phpFile, $md)); + } + + public function testSyncReturnsNullWhenBlankLineSnippetIsUnchanged(): void + { + // The blank line after buildPhpFile('docs/test.md', $bodyLine, "syncer->sync($phpFile, $md)); + } + + // ------------------------------------------------------------------------- + // sync — body line out of range + // ------------------------------------------------------------------------- + + public function testSyncReturnsNullForBodyLineOutOfRange(): void + { + $md = "one line\n"; + // Line 999 does not exist in this tiny Markdown. + $phpFile = $this->buildPhpFile('docs/test.md', 999, '$x = 1;'); + + self::assertNull($this->syncer->sync($phpFile, $md)); + } + + // ------------------------------------------------------------------------- + // sync — simple code changes + // ------------------------------------------------------------------------- + + public function testSyncAppliesSimpleCodeChange(): void + { + $md = "text\n\n```php\n\$x=1;\n```\n"; + $bodyLine = self::bodyLineOf($md); + // Simulate cs-fixer adding spaces around = + $phpFile = $this->buildPhpFile('docs/test.md', $bodyLine, '$x = 1;'); + + $result = $this->syncer->sync($phpFile, $md); + + self::assertNotNull($result); + self::assertStringContainsString('$x = 1;', $result); + // Surrounding Markdown structure is preserved + self::assertStringContainsString('text', $result); + self::assertStringContainsString('```php', $result); + } + + public function testSyncAppliesMultiLineCodeChange(): void + { + $md = "```php\n\$a=1;\n\$b=2;\n```\n"; + $bodyLine = self::bodyLineOf($md); + $phpFile = $this->buildPhpFile('docs/test.md', $bodyLine, "\$a = 1;\n\$b = 2;"); + + $result = $this->syncer->sync($phpFile, $md); + + self::assertNotNull($result); + self::assertStringContainsString("\$a = 1;\n\$b = 2;", $result); + } + + // ------------------------------------------------------------------------- + // sync — buildPhpFile('docs/test.md', $bodyLine, "syncer->sync($phpFile, $md); + + self::assertNotNull($result); + self::assertStringContainsString("buildPhpFile('docs/test.md', $bodyLine, '$x = 1;'); + + $result = $this->syncer->sync($phpFile, $md); + + self::assertNotNull($result); + self::assertStringNotContainsString('buildPhpFile('docs/test.md', $bodyLine, "syncer->sync($fixedPhpFile, $md); + + self::assertNotNull($result); + self::assertStringContainsString("buildPhpFile('docs/test.md', $bodyLine, "syncer->sync($fixedPhpFile, $md); + + self::assertNotNull($result); + // The fixed body must come immediately after buildPhpFile('docs/test.md', $bodyLine, '$x = 1;'); + + $result = $this->syncer->sync($phpFile, $md); + + self::assertNotNull($result); + // The 4-space indent must be re-applied to the body line. + self::assertStringContainsString(' $x = 1;', $result); + } + + public function testSyncHandlesIndentedBlockWithPhpTagAndBlankLine(): void + { + $md = "!!! note\n\n ```php\n buildPhpFile('docs/test.md', $bodyLine, "syncer->sync($fixedPhpFile, $md); + + self::assertNotNull($result); + // Both the indent and the blank line must be preserved. + self::assertStringContainsString(" $replacements Simulated cs-fixer changes: old => new. + */ + #[DataProvider('provideRoundtripCases')] + public function testRoundtripAppliesChangesAndIsIdempotent( + string $md, + array $replacements, + string $expectedSnippet + ): void { + $extractor = new MarkdownExtractor('php'); + + // --- First pass: extract, simulate fix, sync --- + $blocks = iterator_to_array($extractor->extract($md)); + self::assertNotEmpty($blocks); + + $block = $blocks[0]; + $phpFile = $this->buildPhpFile('docs/test.md', $block['line'], $block['body']); + + $fixedPhpFile = strtr($phpFile, $replacements); + $hasChange = $fixedPhpFile !== $phpFile; + + $updatedMd = $this->syncer->sync($fixedPhpFile, $md); + + if (!$hasChange) { + self::assertNull($updatedMd, 'No change by fixer; sync must return null'); + + return; + } + + self::assertNotNull($updatedMd); + self::assertStringContainsString($expectedSnippet, $updatedMd); + + // --- Second pass: idempotency check --- + // Re-extract from the updated Markdown; cs-fixer produces no further changes this time. + $blocks2 = iterator_to_array($extractor->extract($updatedMd)); + self::assertNotEmpty($blocks2); + + $block2 = $blocks2[0]; + $phpFile2 = $this->buildPhpFile('docs/test.md', $block2['line'], $block2['body']); + + self::assertNull( + $this->syncer->sync($phpFile2, $updatedMd), + 'Second sync on an already-updated Markdown must return null (idempotent)', + ); + } + + /** + * @return iterable, string}> + */ + public static function provideRoundtripCases(): iterable + { + yield 'plain snippet, spacing fix' => [ + "text\n\n```php\n\$x=1;\n```\n", + ['$x=1;' => '$x = 1;'], + '$x = 1;', + ]; + + yield 'snippet with [ + "text\n\n```php\n '$x = 1;'], + " [ + "text\n\n```php\n '$x = 1;'], + " [ + "text\n\n```php\n\$x = 1;\n```\n", + [], // no replacements + '$x = 1;', + ]; + + yield 'indented snippet, spacing fix' => [ + "!!! note\n\n ```php\n \$x=1;\n ```\n", + ['$x=1;' => '$x = 1;'], + ' $x = 1;', + ]; + + yield 'multiline snippet, import ordering' => [ + "```php\n 'use A\\Bar;' . "\n" . 'use B\\Foo;'], + "use A\\Bar;\nuse B\\Foo;", + ]; + } + + // ------------------------------------------------------------------------- + // Line-number stability: blocks from the same file, processed high→low + // ------------------------------------------------------------------------- + + public function testLaterBlockUnaffectedWhenEarlierBlockShrinks(): void + { + // Two PHP blocks in the same Markdown. The first block will have a line removed + // (blank line after extract($md)); + self::assertCount(2, $blocks); + + [$blockA, $blockB] = $blocks; + + $phpFileA = $this->buildPhpFile('docs/test.md', $blockA['line'], $blockA['body']); + // Simulate cs-fixer removing the blank line after buildPhpFile('docs/test.md', $blockB['line'], $blockB['body']); + $fixedPhpFileB = str_replace('$b=2;', '$b = 2;', $phpFileB); + + // Apply block A first (it changes line count), then block B. + // Block B must still land in the right place. + $md1 = $this->syncer->sync($fixedPhpFileA, $md) ?? $md; + $md2 = $this->syncer->sync($fixedPhpFileB, $md1) ?? $md1; + + self::assertStringContainsString('$a=99;', $md2); + self::assertStringContainsString('$b = 2;', $md2); + // The second block must still be in a php fence + self::assertMatchesRegularExpression('/```php\n\$b = 2;\n```/', $md2); + } +} diff --git a/tests/InlineSamples/InlinePhpWriter.php b/tests/InlineSamples/InlinePhpWriter.php new file mode 100644 index 0000000000..3212cc41d8 --- /dev/null +++ b/tests/InlineSamples/InlinePhpWriter.php @@ -0,0 +1,56 @@ + + * + * + * Important: the writer = new InlinePhpWriter(); + } + + // ------------------------------------------------------------------------- + // Header structure + // ------------------------------------------------------------------------- + + public function testFileAlwaysStartsWithPhpOpeningTag(): void + { + $content = $this->writer->build('docs/example.md', 5, '$x = 1;'); + self::assertStringStartsWith("writer->build('docs/api/example.md', 42, '$x = 1;'); + self::assertStringContainsString('// Source: docs/api/example.md:42', $content); + } + + public function testAutoGeneratedCommentIsPresent(): void + { + $content = $this->writer->build('docs/example.md', 1, '$x = 1;'); + self::assertStringContainsString( + '// (auto-generated by tools/extract-inline-php.php — do not edit)', + $content, + ); + } + + public function testBlankLineSeparatesHeaderFromBody(): void + { + $content = $this->writer->build('docs/example.md', 1, '$x = 1;'); + // The blank line sits between the auto-generated comment and the body. + self::assertStringContainsString( + "// (auto-generated by tools/extract-inline-php.php — do not edit)\n\n\$x = 1;", + $content, + ); + } + + public function testFileEndsWithSingleTrailingNewline(): void + { + $content = $this->writer->build('docs/example.md', 1, '$x = 1;'); + self::assertStringEndsWith("\$x = 1;\n", $content); + // Not two newlines + self::assertStringNotContainsString("\$x = 1;\n\n", $content); + } + + // ------------------------------------------------------------------------- + // Body without writer->build('docs/example.md', 10, '$foo = bar();'); + self::assertStringContainsString('$foo = bar();', $content); + } + + public function testMultiLineBodyIsPreserved(): void + { + $body = "\$a = 1;\n\$b = 2;\nreturn \$a + \$b;"; + $content = $this->writer->build('docs/example.md', 5, $body); + self::assertStringContainsString($body, $content); + } + + // ------------------------------------------------------------------------- + // Body with writer->build('docs/example.md', 3, "writer->build('docs/example.md', 4, "writer->build('docs/example.md', 7, " writer->build('docs/example.md', 3, $body); + // Namespace must be in the file body (after the header blank line). + self::assertStringContainsString('namespace App\\Foo;', $content); + self::assertSame(1, substr_count($content, 'writer->build($sourcePath, $line, $body)); + } + + /** + * @return iterable + */ + public static function provideExactContent(): iterable + { + yield 'plain body' => [ + 'docs/api/example.md', 5, '$x = 1;', '$x = 1;', + ]; + + yield 'multiline plain body' => [ + 'docs/api/example.md', 10, "\$a = 1;\n\$b = 2;", "\$a = 1;\n\$b = 2;", + ]; + + yield 'body with php tag, no blank line' => [ + 'docs/foo.md', 3, " [ + 'docs/foo.md', 4, " [ + 'docs/bar.md', 7, + " + * - ``` + * - ``` hl_lines="..." * - Blocks indented inside admonitions (4-space prefix) * * Blocks containing [[= include_file(...) =]], [[= include_code(...) =]], or --8<-- are skipped * because they reference code_samples/ files that are validated separately. + * + * Blocks whose opening fence contains the marker "skip-validation" are also + * skipped, e.g.: ```php skip-validation + * The marker has no effect on MkDocs rendering — it is treated as an additional + * CSS class on the rendered code block. */ -final class MarkdownYamlExtractor +final class MarkdownExtractor { /** * Pattern components: * - ^( *) captures optional leading indentation (admonitions indent by 4 spaces) - * - ```\s*yaml matches the opening fence with optional space before language tag - * - [^\n]* allows trailing annotations like hl_lines="1 2" + * - ```\s* matches the opening fence with optional space before language tag + * - (?P[^\n]*) captures the rest of the opening line (hl_lines, custom markers…) * - (.*?) captures the block body (non-greedy) * - \n\1``` requires the closing fence to match the same indentation */ - private const string FENCE_PATTERN = '/^(?P *)```\s*yaml[^\n]*\n(?P.*?)\n(?P=indent)```/ms'; + private string $fencePattern; private const string SKIP_PATTERN = '/include_(?:file|code)\s*\(|--8<--/'; + private const string SKIP_VALIDATION_MARKER = 'skip-validation'; + + public function __construct(string $language) + { + $this->fencePattern = '/^(?P *)```\s*' . preg_quote($language, '/') . '(?P[^\n]*)\n(?P.*?)\n(?P=indent)```/ms'; + } + /** * @return iterable */ public function extract(string $content): iterable { - if (!preg_match_all(self::FENCE_PATTERN, $content, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) { + if (!preg_match_all($this->fencePattern, $content, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) { return; } foreach ($matches as $match) { + $info = $match['info'][0]; $body = $match['body'][0]; $offset = $match['body'][1]; + if (str_contains($info, self::SKIP_VALIDATION_MARKER)) { + continue; + } + if (preg_match(self::SKIP_PATTERN, $body)) { continue; } diff --git a/tests/Markdown/MarkdownYamlExtractorTest.php b/tests/InlineSamples/MarkdownExtractorTest.php similarity index 96% rename from tests/Markdown/MarkdownYamlExtractorTest.php rename to tests/InlineSamples/MarkdownExtractorTest.php index 0575ae51df..7cf6e312aa 100644 --- a/tests/Markdown/MarkdownYamlExtractorTest.php +++ b/tests/InlineSamples/MarkdownExtractorTest.php @@ -6,18 +6,18 @@ */ declare(strict_types=1); -namespace Ibexa\Tests\Documentation\Markdown; +namespace Ibexa\Tests\Documentation\InlineSamples; use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; -final class MarkdownYamlExtractorTest extends TestCase +final class MarkdownExtractorTest extends TestCase { - private MarkdownYamlExtractor $extractor; + private MarkdownExtractor $extractor; protected function setUp(): void { - $this->extractor = new MarkdownYamlExtractor(); + $this->extractor = new MarkdownExtractor('yaml'); } public function testExtractsNothing(): void diff --git a/tests/Yaml/YamlSamplesProvider.php b/tests/Yaml/YamlSamplesProvider.php index 5dbc63da45..0624536097 100644 --- a/tests/Yaml/YamlSamplesProvider.php +++ b/tests/Yaml/YamlSamplesProvider.php @@ -8,7 +8,7 @@ namespace Ibexa\Tests\Documentation\Yaml; -use Ibexa\Tests\Documentation\Markdown\MarkdownYamlExtractor; +use Ibexa\Tests\Documentation\InlineSamples\MarkdownExtractor; use RecursiveDirectoryIterator; use RecursiveIteratorIterator; @@ -70,7 +70,7 @@ private function iterateCodeSampleYaml(): iterable */ private function iterateMarkdownYamlBlocks(): iterable { - $extractor = new MarkdownYamlExtractor(); + $extractor = new MarkdownExtractor('yaml'); $iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator(self::DOCS_DIR, RecursiveDirectoryIterator::SKIP_DOTS) ); diff --git a/tools/extract-inline-php.php b/tools/extract-inline-php.php new file mode 100644 index 0000000000..b3b56d1634 --- /dev/null +++ b/tools/extract-inline-php.php @@ -0,0 +1,135 @@ +#!/usr/bin/env php +isDir()) { + rmdir($item->getRealPath()); + } else { + unlink($item->getRealPath()); + } + } + + rmdir($dir); +} + +// Clean up the output directory from the previous run to avoid stale files +// (e.g. from docs that were renamed, moved, or had snippets removed). +removeDirectory(OUTPUT_DIR); + +// Always recreate the root output directory so downstream tools (Rector, +// PHP-CS-Fixer) that receive it as a path argument don't fail when there +// happen to be zero snippets to extract. +if (!mkdir(OUTPUT_DIR, 0755, true) && !is_dir(OUTPUT_DIR)) { + fwrite(STDERR, 'ERROR: Could not create directory: ' . OUTPUT_DIR . "\n"); + exit(1); +} + +$extractor = new MarkdownExtractor('php'); +$writer = new InlinePhpWriter(); + +$iterator = new RecursiveIteratorIterator( + new RecursiveDirectoryIterator(DOCS_DIR, RecursiveDirectoryIterator::SKIP_DOTS), +); + +$fileCount = 0; +$snippetCount = 0; + +/** @var SplFileInfo $file */ +foreach ($iterator as $file) { + if (!$file->isFile() || $file->getExtension() !== 'md') { + continue; + } + + $mdPath = $file->getRealPath(); + $content = file_get_contents($mdPath); + + if ($content === false) { + continue; + } + + $blocks = iterator_to_array($extractor->extract($content)); + + if (empty($blocks)) { + continue; + } + + // Relative path from docs/ root, e.g. "commerce/cart/cart_api.md" + $relativeFromDocs = ltrim(substr($mdPath, strlen(realpath(DOCS_DIR))), DIRECTORY_SEPARATOR); + + // Strip .md extension and use as subdirectory name + $subDir = OUTPUT_DIR . DIRECTORY_SEPARATOR . substr($relativeFromDocs, 0, -3); + + if (!is_dir($subDir) && !mkdir($subDir, 0755, true) && !is_dir($subDir)) { + fwrite(STDERR, "ERROR: Could not create directory: $subDir\n"); + exit(1); + } + + // Relative path used in the source comment, e.g. "docs/commerce/cart/cart_api.md" + $sourceRelPath = 'docs/' . str_replace(DIRECTORY_SEPARATOR, '/', $relativeFromDocs); + + foreach ($blocks as $block) { + $line = $block['line']; + $body = $block['body']; + + $outputFile = $subDir . DIRECTORY_SEPARATOR . "line_{$line}.php"; + + file_put_contents($outputFile, $writer->build($sourceRelPath, $line, $body)); + ++$snippetCount; + } + + ++$fileCount; +} + +echo sprintf( + "Extracted %d PHP snippet%s from %d Markdown file%s → code_samples/_inline_php/\n", + $snippetCount, + $snippetCount !== 1 ? 's' : '', + $fileCount, + $fileCount !== 1 ? 's' : '', +); diff --git a/tools/sync-inline-php-to-markdown.php b/tools/sync-inline-php-to-markdown.php new file mode 100644 index 0000000000..eb8a9707ff --- /dev/null +++ b/tools/sync-inline-php-to-markdown.php @@ -0,0 +1,122 @@ +#!/usr/bin/env php +/line_N.php, prepending an auto-generated header: + * + * + * + * + * After php-cs-fixer reformats the files, this script: + * 1. Groups all _inline_php files by their source Markdown path. + * 2. Processes each group in descending line order so that patching a later block + * never shifts the line numbers of earlier blocks that are still to be processed. + * 3. For each file, delegates the sync logic to InlinePhpSyncer and writes the result. + * + * Run automatically after php-cs-fixer via `composer fix-cs`. + */ + +declare(strict_types=1); + +require_once __DIR__ . '/../vendor/autoload.php'; + +use Ibexa\Tests\Documentation\InlineSamples\InlinePhpSyncer; + +const INLINE_PHP_DIR = __DIR__ . '/../code_samples/_inline_php'; +const REPO_ROOT = __DIR__ . '/..'; + +$syncer = new InlinePhpSyncer(); + +// --- Pass 1: collect all _inline_php files grouped by their source Markdown path. --- + +/** @var array> $byMdPath */ +$byMdPath = []; + +$iterator = new RecursiveIteratorIterator( + new RecursiveDirectoryIterator(INLINE_PHP_DIR, RecursiveDirectoryIterator::SKIP_DOTS), +); + +/** @var SplFileInfo $file */ +foreach ($iterator as $file) { + if (!$file->isFile() || $file->getExtension() !== 'php') { + continue; + } + + $content = file_get_contents($file->getRealPath()); + if ($content === false) { + continue; + } + + $location = $syncer->parseSourceLocation($content); + if ($location === null) { + fwrite(STDERR, "WARNING: No '// Source:' comment found in {$file->getRealPath()}, skipping.\n"); + continue; + } + + $mdPath = REPO_ROOT . '/' . $location['path']; + $byMdPath[$mdPath][] = ['phpPath' => $file->getRealPath(), 'line' => $location['line']]; +} + +// --- Pass 2: for each Markdown file, apply patches in descending line order. --- +// This ensures that modifying a block at line N does not shift the line numbers +// of blocks at lines < N that are yet to be processed. + +$patchCount = 0; + +foreach ($byMdPath as $mdPath => $entries) { + if (!is_file($mdPath)) { + fwrite(STDERR, "WARNING: Source file not found: $mdPath, skipping.\n"); + continue; + } + + $mdContent = file_get_contents($mdPath); + if ($mdContent === false) { + fwrite(STDERR, "WARNING: Cannot read $mdPath, skipping.\n"); + continue; + } + + // Sort highest body line first so earlier patches do not invalidate later line numbers. + usort($entries, static fn (array $a, array $b): int => $b['line'] <=> $a['line']); + + $mdChanged = false; + + foreach ($entries as ['phpPath' => $phpPath, 'line' => $line]) { + $phpContent = file_get_contents($phpPath); + if ($phpContent === false) { + continue; + } + + $updated = $syncer->sync($phpContent, $mdContent); + if ($updated === null) { + continue; + } + + $mdContent = $updated; + $mdChanged = true; + + echo "Updated: " . substr($mdPath, strlen(REPO_ROOT) + 1) . " (block at line $line)\n"; + ++$patchCount; + } + + if ($mdChanged) { + file_put_contents($mdPath, $mdContent); + } +} + +echo sprintf( + "Synced %d block%s back to Markdown files.\n", + $patchCount, + $patchCount !== 1 ? 's' : '', +); +