Skip to content

Conversation

@dabrt
Copy link
Contributor

@dabrt dabrt commented Nov 19, 2025

Question Answer
JIRA Ticket IBX-10937
Versions 4.6, 5.0
Edition all

Document the ContentTypeGroupName criterion added in ibexa/core#675

Link to API reference will work once the reference is rebuilt after the release.

Note: Merge after the release.

Checklist

  • Text renders correctly
  • Text has been checked with vale
  • Code samples are working
  • Added link to this PR in relevant JIRA ticket or code PR

@dabrt dabrt requested a review from barw4 November 19, 2025 10:36
@dabrt dabrt added Needs DEV review Wait with merge PRs that shouldn't be merged instantly labels Nov 19, 2025
@github-actions
Copy link

Preview of modified files

Preview of modified Markdown:

@github-actions
Copy link

code_samples/ change report

Before (on target branch)After (in current PR)

code_samples/api/public_php_api/src/Command/FindContentTypeCommand.php

docs/content_management/content_api/managing_content.md@180:```php hl_lines="28-38"
docs/content_management/content_api/managing_content.md@181:[[= include_file('code_samples/api/public_php_api/src/Command/FindContentTypeCommand.php') =]]
docs/content_management/content_api/managing_content.md@182:```

001⫶<?php declare(strict_types=1);
002⫶
003⫶namespace App\Command;
004⫶
005⫶use Ibexa\Contracts\Core\Repository\ContentTypeService;
006⫶use Ibexa\Contracts\Core\Repository\Values\ContentType\Query\ContentTypeQuery;
007⫶use Ibexa\Contracts\Core\Repository\Values\ContentType\Query\Criterion;
008⫶use Ibexa\Contracts\Core\Repository\Values\ContentType\Query\SortClause;
009⫶use Symfony\Component\Console\Attribute\AsCommand;
010⫶use Symfony\Component\Console\Command\Command;
011⫶use Symfony\Component\Console\Input\InputInterface;
012⫶use Symfony\Component\Console\Output\OutputInterface;
013⫶
014⫶#[AsCommand(
015⫶ name: 'doc:find_content_types',
016⫶ description: 'Lists content types that match specific criteria.'
017⫶)]
018⫶class FindContentTypeCommand extends Command
019⫶{
020⫶ public function __construct(private readonly ContentTypeService $contentTypeService)
021⫶ {
022⫶ parent::__construct();
023⫶ }
024⫶
025⫶ protected function execute(InputInterface $input, OutputInterface $output): int
026⫶ {
027⫶ // Find content types from the "Content" group that contains a specific field definition (in this case, a "Body" field).
028❇️ $query = new ContentTypeQuery(
029❇️ new Criterion\LogicalAnd([

code_samples/api/public_php_api/src/Command/FindContentTypeCommand.php

docs/content_management/content_api/managing_content.md@180:```php hl_lines="28-38"
docs/content_management/content_api/managing_content.md@181:[[= include_file('code_samples/api/public_php_api/src/Command/FindContentTypeCommand.php') =]]
docs/content_management/content_api/managing_content.md@182:```

001⫶<?php declare(strict_types=1);
002⫶
003⫶namespace App\Command;
004⫶
005⫶use Ibexa\Contracts\Core\Repository\ContentTypeService;
006⫶use Ibexa\Contracts\Core\Repository\Values\ContentType\Query\ContentTypeQuery;
007⫶use Ibexa\Contracts\Core\Repository\Values\ContentType\Query\Criterion;
008⫶use Ibexa\Contracts\Core\Repository\Values\ContentType\Query\SortClause;
009⫶use Symfony\Component\Console\Attribute\AsCommand;
010⫶use Symfony\Component\Console\Command\Command;
011⫶use Symfony\Component\Console\Input\InputInterface;
012⫶use Symfony\Component\Console\Output\OutputInterface;
013⫶
014⫶#[AsCommand(
015⫶ name: 'doc:find_content_types',
016⫶ description: 'Lists content types that match specific criteria.'
017⫶)]
018⫶class FindContentTypeCommand extends Command
019⫶{
020⫶ public function __construct(private readonly ContentTypeService $contentTypeService)
021⫶ {
022⫶ parent::__construct();
023⫶ }
024⫶
025⫶ protected function execute(InputInterface $input, OutputInterface $output): int
026⫶ {
027⫶ // Find content types from the "Content" group that contains a specific field definition (in this case, a "Body" field).
028❇️ $query = new ContentTypeQuery(
029❇️ new Criterion\LogicalAnd([
030❇️                new Criterion\ContentTypeGroupId([1]),
030❇️                new Criterion\ContentTypeGroupName(['Content']),
031❇️                new Criterion\ContainsFieldDefinitionId([121]),
032❇️ ]),
033❇️ [
034❇️ new SortClause\Id(),
035❇️ new SortClause\Identifier(),
036❇️ new SortClause\Name(),
037❇️ ]
038❇️ );
039⫶
040⫶ $searchResult = $this->contentTypeService->findContentTypes($query);
041⫶
042⫶ $output->writeln('Found ' . $searchResult->getTotalCount() . ' content type(s):');
043⫶
044⫶ foreach ($searchResult->getContentTypes() as $contentType) {
045⫶ $output->writeln(sprintf(
046⫶ '- [%d] %s (identifier: %s)',
047⫶ $contentType->id,
048⫶ $contentType->getName(),
049⫶ $contentType->identifier
050⫶ ));
051⫶ }
052⫶
053⫶ return Command::SUCCESS;
054⫶ }
055⫶}

031❇️                new Criterion\ContainsFieldDefinitionId([121]),
032❇️ ]),
033❇️ [
034❇️ new SortClause\Id(),
035❇️ new SortClause\Identifier(),
036❇️ new SortClause\Name(),
037❇️ ]
038❇️ );
039⫶
040⫶ $searchResult = $this->contentTypeService->findContentTypes($query);
041⫶
042⫶ $output->writeln('Found ' . $searchResult->getTotalCount() . ' content type(s):');
043⫶
044⫶ foreach ($searchResult->getContentTypes() as $contentType) {
045⫶ $output->writeln(sprintf(
046⫶ '- [%d] %s (identifier: %s)',
047⫶ $contentType->id,
048⫶ $contentType->getName(),
049⫶ $contentType->identifier
050⫶ ));
051⫶ }
052⫶
053⫶ return Command::SUCCESS;
054⫶ }
055⫶}

docs/search/content_type_search_reference/content_type_criteria.md@24:```php hl_lines="29-31"
docs/search/content_type_search_reference/content_type_criteria.md@25:[[= include_file('code_samples/api/public_php_api/src/Command/FindContentTypeCommand.php') =]]
docs/search/content_type_search_reference/content_type_criteria.md@26:```
docs/search/content_type_search_reference/content_type_criteria.md@25:```php hl_lines="29-31"
docs/search/content_type_search_reference/content_type_criteria.md@26:[[= include_file('code_samples/api/public_php_api/src/Command/FindContentTypeCommand.php') =]]
docs/search/content_type_search_reference/content_type_criteria.md@27:```

001⫶<?php declare(strict_types=1);
002⫶
003⫶namespace App\Command;
004⫶
005⫶use Ibexa\Contracts\Core\Repository\ContentTypeService;
006⫶use Ibexa\Contracts\Core\Repository\Values\ContentType\Query\ContentTypeQuery;
007⫶use Ibexa\Contracts\Core\Repository\Values\ContentType\Query\Criterion;
008⫶use Ibexa\Contracts\Core\Repository\Values\ContentType\Query\SortClause;
009⫶use Symfony\Component\Console\Attribute\AsCommand;
010⫶use Symfony\Component\Console\Command\Command;
011⫶use Symfony\Component\Console\Input\InputInterface;
012⫶use Symfony\Component\Console\Output\OutputInterface;
013⫶
014⫶#[AsCommand(
015⫶ name: 'doc:find_content_types',
016⫶ description: 'Lists content types that match specific criteria.'
017⫶)]
018⫶class FindContentTypeCommand extends Command
019⫶{
020⫶ public function __construct(private readonly ContentTypeService $contentTypeService)
021⫶ {
022⫶ parent::__construct();
023⫶ }
024⫶
025⫶ protected function execute(InputInterface $input, OutputInterface $output): int
026⫶ {
027⫶ // Find content types from the "Content" group that contains a specific field definition (in this case, a "Body" field).
028⫶ $query = new ContentTypeQuery(
029❇️ new Criterion\LogicalAnd([

001⫶<?php declare(strict_types=1);
002⫶
003⫶namespace App\Command;
004⫶
005⫶use Ibexa\Contracts\Core\Repository\ContentTypeService;
006⫶use Ibexa\Contracts\Core\Repository\Values\ContentType\Query\ContentTypeQuery;
007⫶use Ibexa\Contracts\Core\Repository\Values\ContentType\Query\Criterion;
008⫶use Ibexa\Contracts\Core\Repository\Values\ContentType\Query\SortClause;
009⫶use Symfony\Component\Console\Attribute\AsCommand;
010⫶use Symfony\Component\Console\Command\Command;
011⫶use Symfony\Component\Console\Input\InputInterface;
012⫶use Symfony\Component\Console\Output\OutputInterface;
013⫶
014⫶#[AsCommand(
015⫶ name: 'doc:find_content_types',
016⫶ description: 'Lists content types that match specific criteria.'
017⫶)]
018⫶class FindContentTypeCommand extends Command
019⫶{
020⫶ public function __construct(private readonly ContentTypeService $contentTypeService)
021⫶ {
022⫶ parent::__construct();
023⫶ }
024⫶
025⫶ protected function execute(InputInterface $input, OutputInterface $output): int
026⫶ {
027⫶ // Find content types from the "Content" group that contains a specific field definition (in this case, a "Body" field).
028⫶ $query = new ContentTypeQuery(
029❇️ new Criterion\LogicalAnd([
030❇️                new Criterion\ContentTypeGroupId([1]),
030❇️                new Criterion\ContentTypeGroupName(['Content']),
031❇️                new Criterion\ContainsFieldDefinitionId([121]),
032⫶ ]),
033⫶ [
034⫶ new SortClause\Id(),
035⫶ new SortClause\Identifier(),
036⫶ new SortClause\Name(),
037⫶ ]
038⫶ );
039⫶
040⫶ $searchResult = $this->contentTypeService->findContentTypes($query);
041⫶
042⫶ $output->writeln('Found ' . $searchResult->getTotalCount() . ' content type(s):');
043⫶
044⫶ foreach ($searchResult->getContentTypes() as $contentType) {
045⫶ $output->writeln(sprintf(
046⫶ '- [%d] %s (identifier: %s)',
047⫶ $contentType->id,
048⫶ $contentType->getName(),
049⫶ $contentType->identifier
050⫶ ));
051⫶ }
052⫶
053⫶ return Command::SUCCESS;
054⫶ }
055⫶}

docs/search/content_type_search_reference/content_type_sort_clauses.md@22:```php hl_lines="34-36"
docs/search/content_type_search_reference/content_type_sort_clauses.md@23:[[= include_file('code_samples/api/public_php_api/src/Command/FindContentTypeCommand.php') =]]
docs/search/content_type_search_reference/content_type_sort_clauses.md@24:```

001⫶<?php declare(strict_types=1);
002⫶
003⫶namespace App\Command;
004⫶
005⫶use Ibexa\Contracts\Core\Repository\ContentTypeService;
006⫶use Ibexa\Contracts\Core\Repository\Values\ContentType\Query\ContentTypeQuery;
007⫶use Ibexa\Contracts\Core\Repository\Values\ContentType\Query\Criterion;
008⫶use Ibexa\Contracts\Core\Repository\Values\ContentType\Query\SortClause;
009⫶use Symfony\Component\Console\Attribute\AsCommand;
010⫶use Symfony\Component\Console\Command\Command;
011⫶use Symfony\Component\Console\Input\InputInterface;
012⫶use Symfony\Component\Console\Output\OutputInterface;
013⫶
014⫶#[AsCommand(
015⫶ name: 'doc:find_content_types',
016⫶ description: 'Lists content types that match specific criteria.'
017⫶)]
018⫶class FindContentTypeCommand extends Command
019⫶{
020⫶ public function __construct(private readonly ContentTypeService $contentTypeService)
021⫶ {
022⫶ parent::__construct();
023⫶ }
024⫶
025⫶ protected function execute(InputInterface $input, OutputInterface $output): int
026⫶ {
027⫶ // Find content types from the "Content" group that contains a specific field definition (in this case, a "Body" field).
028⫶ $query = new ContentTypeQuery(
029⫶ new Criterion\LogicalAnd([
031❇️                new Criterion\ContainsFieldDefinitionId([121]),
032⫶ ]),
033⫶ [
034⫶ new SortClause\Id(),
035⫶ new SortClause\Identifier(),
036⫶ new SortClause\Name(),
037⫶ ]
038⫶ );
039⫶
040⫶ $searchResult = $this->contentTypeService->findContentTypes($query);
041⫶
042⫶ $output->writeln('Found ' . $searchResult->getTotalCount() . ' content type(s):');
043⫶
044⫶ foreach ($searchResult->getContentTypes() as $contentType) {
045⫶ $output->writeln(sprintf(
046⫶ '- [%d] %s (identifier: %s)',
047⫶ $contentType->id,
048⫶ $contentType->getName(),
049⫶ $contentType->identifier
050⫶ ));
051⫶ }
052⫶
053⫶ return Command::SUCCESS;
054⫶ }
055⫶}

docs/search/content_type_search_reference/content_type_sort_clauses.md@22:```php hl_lines="34-36"
docs/search/content_type_search_reference/content_type_sort_clauses.md@23:[[= include_file('code_samples/api/public_php_api/src/Command/FindContentTypeCommand.php') =]]
docs/search/content_type_search_reference/content_type_sort_clauses.md@24:```

001⫶<?php declare(strict_types=1);
002⫶
003⫶namespace App\Command;
004⫶
005⫶use Ibexa\Contracts\Core\Repository\ContentTypeService;
006⫶use Ibexa\Contracts\Core\Repository\Values\ContentType\Query\ContentTypeQuery;
007⫶use Ibexa\Contracts\Core\Repository\Values\ContentType\Query\Criterion;
008⫶use Ibexa\Contracts\Core\Repository\Values\ContentType\Query\SortClause;
009⫶use Symfony\Component\Console\Attribute\AsCommand;
010⫶use Symfony\Component\Console\Command\Command;
011⫶use Symfony\Component\Console\Input\InputInterface;
012⫶use Symfony\Component\Console\Output\OutputInterface;
013⫶
014⫶#[AsCommand(
015⫶ name: 'doc:find_content_types',
016⫶ description: 'Lists content types that match specific criteria.'
017⫶)]
018⫶class FindContentTypeCommand extends Command
019⫶{
020⫶ public function __construct(private readonly ContentTypeService $contentTypeService)
021⫶ {
022⫶ parent::__construct();
023⫶ }
024⫶
025⫶ protected function execute(InputInterface $input, OutputInterface $output): int
026⫶ {
027⫶ // Find content types from the "Content" group that contains a specific field definition (in this case, a "Body" field).
028⫶ $query = new ContentTypeQuery(
029⫶ new Criterion\LogicalAnd([
030⫶                new Criterion\ContentTypeGroupId([1]),
030⫶                new Criterion\ContentTypeGroupName(['Content']),
031⫶                new Criterion\ContainsFieldDefinitionId([121]),
032⫶ ]),
033⫶ [
034❇️ new SortClause\Id(),
035❇️ new SortClause\Identifier(),
036❇️ new SortClause\Name(),
037⫶ ]
038⫶ );
039⫶
040⫶ $searchResult = $this->contentTypeService->findContentTypes($query);
041⫶
042⫶ $output->writeln('Found ' . $searchResult->getTotalCount() . ' content type(s):');
043⫶
044⫶ foreach ($searchResult->getContentTypes() as $contentType) {
045⫶ $output->writeln(sprintf(
046⫶ '- [%d] %s (identifier: %s)',
047⫶ $contentType->id,
048⫶ $contentType->getName(),
049⫶ $contentType->identifier
050⫶ ));
051⫶ }
052⫶
053⫶ return Command::SUCCESS;
054⫶ }
055⫶}

031⫶                new Criterion\ContainsFieldDefinitionId([121]),
032⫶ ]),
033⫶ [
034❇️ new SortClause\Id(),
035❇️ new SortClause\Identifier(),
036❇️ new SortClause\Name(),
037⫶ ]
038⫶ );
039⫶
040⫶ $searchResult = $this->contentTypeService->findContentTypes($query);
041⫶
042⫶ $output->writeln('Found ' . $searchResult->getTotalCount() . ' content type(s):');
043⫶
044⫶ foreach ($searchResult->getContentTypes() as $contentType) {
045⫶ $output->writeln(sprintf(
046⫶ '- [%d] %s (identifier: %s)',
047⫶ $contentType->id,
048⫶ $contentType->getName(),
049⫶ $contentType->identifier
050⫶ ));
051⫶ }
052⫶
053⫶ return Command::SUCCESS;
054⫶ }
055⫶}

Download colorized diff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs DOC review Wait with merge PRs that shouldn't be merged instantly

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants