Skip to content

Conversation

mnocon
Copy link
Contributor

@mnocon mnocon commented Jul 30, 2025

Making PHPStan happy after changes from ibexa/content-forms#95

 ------ -----------------------------------------------------------------------------------------------------
  Line   field_types/2dpoint_ft/src/FieldType/Point2D/Type.php
 ------ -----------------------------------------------------------------------------------------------------
  35     Access to protected property Ibexa\Contracts\ContentForms\Data\Content\FieldData::$fieldDefinition.
         🪪  property.protected
 ------ -----------------------------------------------------------------------------------------------------

 ------ -----------------------------------------------------------------------------------------------------
  Line   field_types/2dpoint_ft/steps/step_3/Type.php
 ------ -----------------------------------------------------------------------------------------------------
  21     Access to protected property Ibexa\Contracts\ContentForms\Data\Content\FieldData::$fieldDefinition.
         🪪  property.protected
 ------ ----------------------------

@github-actions
Copy link

Preview of modified files: no change to preview.

@github-actions
Copy link

code_samples/ change report

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

code_samples/field_types/2dpoint_ft/src/FieldType/Point2D/Type.php

docs/tutorials/generic_field_type/6_settings.md@40:```php
docs/tutorials/generic_field_type/6_settings.md@41:[[= include_file('code_samples/field_types/2dpoint_ft/src/FieldType/Point2D/Type.php', 0, 4) =]]
docs/tutorials/generic_field_type/6_settings.md@42:[[= include_file('code_samples/field_types/2dpoint_ft/src/FieldType/Point2D/Type.php', 7, 8) =]]
docs/tutorials/generic_field_type/6_settings.md@43:
docs/tutorials/generic_field_type/6_settings.md@44:// ...
docs/tutorials/generic_field_type/6_settings.md@45:
docs/tutorials/generic_field_type/6_settings.md@46:[[= include_file('code_samples/field_types/2dpoint_ft/src/FieldType/Point2D/Type.php', 14, 15) =]]
docs/tutorials/generic_field_type/6_settings.md@47:
docs/tutorials/generic_field_type/6_settings.md@48:// ...
docs/tutorials/generic_field_type/6_settings.md@49:
docs/tutorials/generic_field_type/6_settings.md@50:[[= include_file('code_samples/field_types/2dpoint_ft/src/FieldType/Point2D/Type.php', 40, 46) =]]
docs/tutorials/generic_field_type/6_settings.md@51:```

001⫶<?php
002⫶declare(strict_types=1);
003⫶
004⫶namespace App\FieldType\Point2D;
005⫶
006⫶use Ibexa\AdminUi\FieldType\FieldDefinitionFormMapperInterface;
007⫶
008⫶
009⫶// ...
010⫶
011⫶final class Type extends GenericType implements FieldValueFormMapperInterface, FieldDefinitionFormMapperInterface
012⫶
013⫶
014⫶// ...
015⫶
016⫶
017⫶ public function mapFieldDefinitionForm(FormInterface $fieldDefinitionForm, FieldDefinitionData $data): void
018⫶ {
019⫶ $fieldDefinitionForm->add('fieldSettings', Point2DSettingsType::class, [
020⫶ 'label' => false,
021⫶ ]);

docs/tutorials/generic_field_type/6_settings.md@55:```php
docs/tutorials/generic_field_type/6_settings.md@56:[[= include_file('code_samples/field_types/2dpoint_ft/src/FieldType/Point2D/Type.php') =]]
docs/tutorials/generic_field_type/6_settings.md@57:```

001⫶<?php
002⫶declare(strict_types=1);
003⫶
004⫶namespace App\FieldType\Point2D;
005⫶
006⫶use App\Form\Type\Point2DSettingsType;
007⫶use App\Form\Type\Point2DType;
008⫶use Ibexa\AdminUi\FieldType\FieldDefinitionFormMapperInterface;
009⫶use Ibexa\AdminUi\Form\Data\FieldDefinitionData;
010⫶use Ibexa\Contracts\ContentForms\Data\Content\FieldData;
011⫶use Ibexa\Contracts\ContentForms\FieldType\FieldValueFormMapperInterface;
012⫶use Ibexa\Contracts\Core\FieldType\Generic\Type as GenericType;
013⫶use Symfony\Component\Form\FormInterface;
014⫶
015⫶final class Type extends GenericType implements FieldValueFormMapperInterface, FieldDefinitionFormMapperInterface
016⫶{
017⫶ public function getFieldTypeIdentifier(): string
018⫶ {
019⫶ return 'point2d';
020⫶ }
021⫶
022⫶ #[\Override]
023⫶ public function getSettingsSchema(): array
024⫶ {
025⫶ return [
026⫶ 'format' => [
027⫶ 'type' => 'string',
028⫶ 'default' => '(%x%, %y%)',
029⫶ ],
030⫶ ];
031⫶ }
032⫶
033⫶ public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data): void
034⫶ {

code_samples/field_types/2dpoint_ft/src/FieldType/Point2D/Type.php

docs/tutorials/generic_field_type/6_settings.md@40:```php
docs/tutorials/generic_field_type/6_settings.md@41:[[= include_file('code_samples/field_types/2dpoint_ft/src/FieldType/Point2D/Type.php', 0, 4) =]]
docs/tutorials/generic_field_type/6_settings.md@42:[[= include_file('code_samples/field_types/2dpoint_ft/src/FieldType/Point2D/Type.php', 7, 8) =]]
docs/tutorials/generic_field_type/6_settings.md@43:
docs/tutorials/generic_field_type/6_settings.md@44:// ...
docs/tutorials/generic_field_type/6_settings.md@45:
docs/tutorials/generic_field_type/6_settings.md@46:[[= include_file('code_samples/field_types/2dpoint_ft/src/FieldType/Point2D/Type.php', 14, 15) =]]
docs/tutorials/generic_field_type/6_settings.md@47:
docs/tutorials/generic_field_type/6_settings.md@48:// ...
docs/tutorials/generic_field_type/6_settings.md@49:
docs/tutorials/generic_field_type/6_settings.md@50:[[= include_file('code_samples/field_types/2dpoint_ft/src/FieldType/Point2D/Type.php', 40, 46) =]]
docs/tutorials/generic_field_type/6_settings.md@51:```

001⫶<?php
002⫶declare(strict_types=1);
003⫶
004⫶namespace App\FieldType\Point2D;
005⫶
006⫶use Ibexa\AdminUi\FieldType\FieldDefinitionFormMapperInterface;
007⫶
008⫶
009⫶// ...
010⫶
011⫶final class Type extends GenericType implements FieldValueFormMapperInterface, FieldDefinitionFormMapperInterface
012⫶
013⫶
014⫶// ...
015⫶
016⫶
017⫶ public function mapFieldDefinitionForm(FormInterface $fieldDefinitionForm, FieldDefinitionData $data): void
018⫶ {
019⫶ $fieldDefinitionForm->add('fieldSettings', Point2DSettingsType::class, [
020⫶ 'label' => false,
021⫶ ]);

docs/tutorials/generic_field_type/6_settings.md@55:```php
docs/tutorials/generic_field_type/6_settings.md@56:[[= include_file('code_samples/field_types/2dpoint_ft/src/FieldType/Point2D/Type.php') =]]
docs/tutorials/generic_field_type/6_settings.md@57:```

001⫶<?php
002⫶declare(strict_types=1);
003⫶
004⫶namespace App\FieldType\Point2D;
005⫶
006⫶use App\Form\Type\Point2DSettingsType;
007⫶use App\Form\Type\Point2DType;
008⫶use Ibexa\AdminUi\FieldType\FieldDefinitionFormMapperInterface;
009⫶use Ibexa\AdminUi\Form\Data\FieldDefinitionData;
010⫶use Ibexa\Contracts\ContentForms\Data\Content\FieldData;
011⫶use Ibexa\Contracts\ContentForms\FieldType\FieldValueFormMapperInterface;
012⫶use Ibexa\Contracts\Core\FieldType\Generic\Type as GenericType;
013⫶use Symfony\Component\Form\FormInterface;
014⫶
015⫶final class Type extends GenericType implements FieldValueFormMapperInterface, FieldDefinitionFormMapperInterface
016⫶{
017⫶ public function getFieldTypeIdentifier(): string
018⫶ {
019⫶ return 'point2d';
020⫶ }
021⫶
022⫶ #[\Override]
023⫶ public function getSettingsSchema(): array
024⫶ {
025⫶ return [
026⫶ 'format' => [
027⫶ 'type' => 'string',
028⫶ 'default' => '(%x%, %y%)',
029⫶ ],
030⫶ ];
031⫶ }
032⫶
033⫶ public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data): void
034⫶ {
035⫶        $definition = $data->fieldDefinition;
035⫶        $definition = $data->getFieldDefinition();
036⫶        $fieldForm->add('value', Point2DType::class, [
037⫶ 'required' => $definition->isRequired,
038⫶ 'label' => $definition->getName(),
039⫶ ]);
040⫶ }
041⫶
042⫶ public function mapFieldDefinitionForm(FormInterface $fieldDefinitionForm, FieldDefinitionData $data): void
043⫶ {
044⫶ $fieldDefinitionForm->add('fieldSettings', Point2DSettingsType::class, [
045⫶ 'label' => false,
046⫶ ]);
047⫶ }
048⫶}


code_samples/field_types/2dpoint_ft/steps/step_3/Type.php

docs/tutorials/generic_field_type/3_create_form_for_point2d.md@34:```php hl_lines="7 10 19-26"
docs/tutorials/generic_field_type/3_create_form_for_point2d.md@35:[[= include_file('code_samples/field_types/2dpoint_ft/steps/step_3/Type.php') =]]
docs/tutorials/generic_field_type/3_create_form_for_point2d.md@36:```

001⫶<?php
002⫶declare(strict_types=1);
003⫶
004⫶namespace App\FieldType\Point2D;
005⫶
006⫶use App\Form\Type\Point2DType;
007❇️use Ibexa\Contracts\ContentForms\Data\Content\FieldData;
008⫶use Ibexa\Contracts\ContentForms\FieldType\FieldValueFormMapperInterface;
009⫶use Ibexa\Contracts\Core\FieldType\Generic\Type as GenericType;
010❇️use Symfony\Component\Form\FormInterface;
011⫶
012⫶final class Type extends GenericType implements FieldValueFormMapperInterface
013⫶{
014⫶ public function getFieldTypeIdentifier(): string
015⫶ {
016⫶ return 'point2d';
017⫶ }
018⫶
019❇️ public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data): void
020❇️ {
036⫶        $fieldForm->add('value', Point2DType::class, [
037⫶ 'required' => $definition->isRequired,
038⫶ 'label' => $definition->getName(),
039⫶ ]);
040⫶ }
041⫶
042⫶ public function mapFieldDefinitionForm(FormInterface $fieldDefinitionForm, FieldDefinitionData $data): void
043⫶ {
044⫶ $fieldDefinitionForm->add('fieldSettings', Point2DSettingsType::class, [
045⫶ 'label' => false,
046⫶ ]);
047⫶ }
048⫶}


code_samples/field_types/2dpoint_ft/steps/step_3/Type.php

docs/tutorials/generic_field_type/3_create_form_for_point2d.md@34:```php hl_lines="7 10 19-26"
docs/tutorials/generic_field_type/3_create_form_for_point2d.md@35:[[= include_file('code_samples/field_types/2dpoint_ft/steps/step_3/Type.php') =]]
docs/tutorials/generic_field_type/3_create_form_for_point2d.md@36:```

001⫶<?php
002⫶declare(strict_types=1);
003⫶
004⫶namespace App\FieldType\Point2D;
005⫶
006⫶use App\Form\Type\Point2DType;
007❇️use Ibexa\Contracts\ContentForms\Data\Content\FieldData;
008⫶use Ibexa\Contracts\ContentForms\FieldType\FieldValueFormMapperInterface;
009⫶use Ibexa\Contracts\Core\FieldType\Generic\Type as GenericType;
010❇️use Symfony\Component\Form\FormInterface;
011⫶
012⫶final class Type extends GenericType implements FieldValueFormMapperInterface
013⫶{
014⫶ public function getFieldTypeIdentifier(): string
015⫶ {
016⫶ return 'point2d';
017⫶ }
018⫶
019❇️ public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data): void
020❇️ {
021❇️        $definition = $data->fieldDefinition;
021❇️        $definition = $data->getFieldDefinition();
022❇️        $fieldForm->add('value', Point2DType::class, [
023❇️ 'required' => $definition->isRequired,
024❇️ 'label' => $definition->getName(),
025❇️ ]);
026❇️ }
027⫶}


code_samples/field_types/2dpoint_ft/steps/step_6/Type.php

docs/tutorials/generic_field_type/6_settings.md@18:```php hl_lines="18-26"
docs/tutorials/generic_field_type/6_settings.md@19:[[= include_file('code_samples/field_types/2dpoint_ft/steps/step_6/Type.php') =]]
docs/tutorials/generic_field_type/6_settings.md@20:```

001⫶<?php
002⫶declare(strict_types=1);
003⫶
004⫶namespace App\FieldType\Point2D;
005⫶
006⫶use App\Form\Type\Point2DType;
007⫶use Ibexa\Contracts\ContentForms\Data\Content\FieldData;
008⫶use Ibexa\Contracts\Core\FieldType\Generic\Type as GenericType;
009⫶use Symfony\Component\Form\FormInterface;
010⫶
011⫶final class Type extends GenericType
012⫶{
013⫶ public function getFieldTypeIdentifier(): string
014⫶ {
015⫶ return 'point2d';
016⫶ }
017⫶
018❇️ #[\Override]
019❇️ public function getSettingsSchema(): array
020❇️ {
021❇️ return [
022❇️ 'format' => [
023❇️ 'type' => 'string',
024❇️ 'default' => '(%x%, %y%)',
025❇️ ],
026❇️ ];
027⫶ }
028⫶
029⫶ public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data): void
030⫶ {
022❇️        $fieldForm->add('value', Point2DType::class, [
023❇️ 'required' => $definition->isRequired,
024❇️ 'label' => $definition->getName(),
025❇️ ]);
026❇️ }
027⫶}


code_samples/field_types/2dpoint_ft/steps/step_6/Type.php

docs/tutorials/generic_field_type/6_settings.md@18:```php hl_lines="18-26"
docs/tutorials/generic_field_type/6_settings.md@19:[[= include_file('code_samples/field_types/2dpoint_ft/steps/step_6/Type.php') =]]
docs/tutorials/generic_field_type/6_settings.md@20:```

001⫶<?php
002⫶declare(strict_types=1);
003⫶
004⫶namespace App\FieldType\Point2D;
005⫶
006⫶use App\Form\Type\Point2DType;
007⫶use Ibexa\Contracts\ContentForms\Data\Content\FieldData;
008⫶use Ibexa\Contracts\Core\FieldType\Generic\Type as GenericType;
009⫶use Symfony\Component\Form\FormInterface;
010⫶
011⫶final class Type extends GenericType
012⫶{
013⫶ public function getFieldTypeIdentifier(): string
014⫶ {
015⫶ return 'point2d';
016⫶ }
017⫶
018❇️ #[\Override]
019❇️ public function getSettingsSchema(): array
020❇️ {
021❇️ return [
022❇️ 'format' => [
023❇️ 'type' => 'string',
024❇️ 'default' => '(%x%, %y%)',
025❇️ ],
026❇️ ];
027⫶ }
028⫶
029⫶ public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data): void
030⫶ {
031⫶        $definition = $data->fieldDefinition;
031⫶        $definition = $data->getFieldDefinition();
032⫶        $fieldForm->add('value', Point2DType::class, [
033⫶ 'required' => $definition->isRequired,
034⫶ 'label' => $definition->getName(),
035⫶ ]);
036⫶ }
037⫶}


code_samples/field_types/generic_ft/src/FieldType/HelloWorld/Type.php

docs/content_management/field_types/create_custom_generic_field_type.md@40:```php
docs/content_management/field_types/create_custom_generic_field_type.md@41:[[= include_file('code_samples/field_types/generic_ft/src/FieldType/HelloWorld/Type.php', 0, 6) =]][[= include_file('code_samples/field_types/generic_ft/src/FieldType/HelloWorld/Type.php', 9, 16) =]]}
docs/content_management/field_types/create_custom_generic_field_type.md@42:```

001⫶<?php declare(strict_types=1);
002⫶
003⫶namespace App\FieldType\HelloWorld;
004⫶
005⫶use App\Form\Type\HelloWorldType;
006⫶use Ibexa\Contracts\ContentForms\Data\Content\FieldData;
007⫶
008⫶final class Type extends GenericType implements FieldValueFormMapperInterface
009⫶{
010⫶ public function getFieldTypeIdentifier(): string
011⫶ {
012⫶ return 'hello_world';
013⫶ }
014⫶}

docs/content_management/field_types/create_custom_generic_field_type.md@65:```php hl_lines="6-7 18-26"
docs/content_management/field_types/create_custom_generic_field_type.md@66:[[= include_file('code_samples/field_types/generic_ft/src/FieldType/HelloWorld/Type.php') =]]
docs/content_management/field_types/create_custom_generic_field_type.md@67:```

001⫶<?php declare(strict_types=1);
002⫶
003⫶namespace App\FieldType\HelloWorld;
004⫶
005⫶use App\Form\Type\HelloWorldType;
006❇️use Ibexa\Contracts\ContentForms\Data\Content\FieldData;
007❇️use Ibexa\Contracts\ContentForms\FieldType\FieldValueFormMapperInterface;
008⫶use Ibexa\Contracts\Core\FieldType\Generic\Type as GenericType;
009⫶use Symfony\Component\Form\FormInterface;
010⫶
011⫶final class Type extends GenericType implements FieldValueFormMapperInterface
012⫶{
013⫶ public function getFieldTypeIdentifier(): string
014⫶ {
015⫶ return 'hello_world';
016⫶ }
017⫶
018❇️ public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data): void
019❇️ {
032⫶        $fieldForm->add('value', Point2DType::class, [
033⫶ 'required' => $definition->isRequired,
034⫶ 'label' => $definition->getName(),
035⫶ ]);
036⫶ }
037⫶}


code_samples/field_types/generic_ft/src/FieldType/HelloWorld/Type.php

docs/content_management/field_types/create_custom_generic_field_type.md@40:```php
docs/content_management/field_types/create_custom_generic_field_type.md@41:[[= include_file('code_samples/field_types/generic_ft/src/FieldType/HelloWorld/Type.php', 0, 6) =]][[= include_file('code_samples/field_types/generic_ft/src/FieldType/HelloWorld/Type.php', 9, 16) =]]}
docs/content_management/field_types/create_custom_generic_field_type.md@42:```

001⫶<?php declare(strict_types=1);
002⫶
003⫶namespace App\FieldType\HelloWorld;
004⫶
005⫶use App\Form\Type\HelloWorldType;
006⫶use Ibexa\Contracts\ContentForms\Data\Content\FieldData;
007⫶
008⫶final class Type extends GenericType implements FieldValueFormMapperInterface
009⫶{
010⫶ public function getFieldTypeIdentifier(): string
011⫶ {
012⫶ return 'hello_world';
013⫶ }
014⫶}

docs/content_management/field_types/create_custom_generic_field_type.md@65:```php hl_lines="6-7 18-26"
docs/content_management/field_types/create_custom_generic_field_type.md@66:[[= include_file('code_samples/field_types/generic_ft/src/FieldType/HelloWorld/Type.php') =]]
docs/content_management/field_types/create_custom_generic_field_type.md@67:```

001⫶<?php declare(strict_types=1);
002⫶
003⫶namespace App\FieldType\HelloWorld;
004⫶
005⫶use App\Form\Type\HelloWorldType;
006❇️use Ibexa\Contracts\ContentForms\Data\Content\FieldData;
007❇️use Ibexa\Contracts\ContentForms\FieldType\FieldValueFormMapperInterface;
008⫶use Ibexa\Contracts\Core\FieldType\Generic\Type as GenericType;
009⫶use Symfony\Component\Form\FormInterface;
010⫶
011⫶final class Type extends GenericType implements FieldValueFormMapperInterface
012⫶{
013⫶ public function getFieldTypeIdentifier(): string
014⫶ {
015⫶ return 'hello_world';
016⫶ }
017⫶
018❇️ public function mapFieldValueForm(FormInterface $fieldForm, FieldData $data): void
019❇️ {
020❇️        $definition = $data->fieldDefinition;
020❇️        $definition = $data->getFieldDefinition();
021❇️
022❇️ $fieldForm->add('value', HelloWorldType::class, [
023❇️ 'required' => $definition->isRequired,
024❇️ 'label' => $definition->getName(),
025❇️ ]);
026❇️ }
027⫶}


code_samples/search/custom/src/Query/Criterion/Solr/CameraManufacturerVisitor.php

docs/search/extensibility/create_custom_search_criterion.md@25: ``` php
docs/search/extensibility/create_custom_search_criterion.md@26: --8<--
docs/search/extensibility/create_custom_search_criterion.md@27: code_samples/search/custom/src/Query/Criterion/Solr/CameraManufacturerVisitor.php
docs/search/extensibility/create_custom_search_criterion.md@28: --8<--
docs/search/extensibility/create_custom_search_criterion.md@29: ```

001⫶<?php
002⫶
003⫶declare(strict_types=1);
004⫶
005⫶namespace App\Query\Criterion\Solr;
006⫶
007⫶use App\Query\Criterion\CameraManufacturerCriterion;
008⫶use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface;
009⫶use Ibexa\Contracts\Solr\Query\CriterionVisitor;
010⫶
011⫶final class CameraManufacturerVisitor extends CriterionVisitor
012⫶{
021❇️
022❇️ $fieldForm->add('value', HelloWorldType::class, [
023❇️ 'required' => $definition->isRequired,
024❇️ 'label' => $definition->getName(),
025❇️ ]);
026❇️ }
027⫶}


code_samples/search/custom/src/Query/Criterion/Solr/CameraManufacturerVisitor.php

docs/search/extensibility/create_custom_search_criterion.md@25: ``` php
docs/search/extensibility/create_custom_search_criterion.md@26: --8<--
docs/search/extensibility/create_custom_search_criterion.md@27: code_samples/search/custom/src/Query/Criterion/Solr/CameraManufacturerVisitor.php
docs/search/extensibility/create_custom_search_criterion.md@28: --8<--
docs/search/extensibility/create_custom_search_criterion.md@29: ```

001⫶<?php
002⫶
003⫶declare(strict_types=1);
004⫶
005⫶namespace App\Query\Criterion\Solr;
006⫶
007⫶use App\Query\Criterion\CameraManufacturerCriterion;
008⫶use Ibexa\Contracts\Core\Repository\Values\Content\Query\CriterionInterface;
009⫶use Ibexa\Contracts\Solr\Query\CriterionVisitor;
010⫶
011⫶final class CameraManufacturerVisitor extends CriterionVisitor
012⫶{
013⫶    public function canVisit(CriterionInterface $criterion)
013⫶    public function canVisit(CriterionInterface $criterion): bool
014⫶    {
015⫶ return $criterion instanceof CameraManufacturerCriterion;
016⫶ }
017⫶
018⫶ /**
019⫶ * @param \App\Query\Criterion\CameraManufacturerCriterion $criterion
020⫶ */
014⫶    {
015⫶ return $criterion instanceof CameraManufacturerCriterion;
016⫶ }
017⫶
018⫶ /**
019⫶ * @param \App\Query\Criterion\CameraManufacturerCriterion $criterion
020⫶ */
021⫶    public function visit(CriterionInterface $criterion, CriterionVisitor $subVisitor = null)
021⫶    public function visit(CriterionInterface $criterion, ?CriterionVisitor $subVisitor = null): string
022⫶    {
023⫶ $expressions = array_map(
024⫶ fn ($value): string => 'exif_camera_manufacturer_id:"' . $this->escapeQuote((string) $value) . '"',
025⫶ $criterion->value
026⫶ );
027⫶
028⫶ return '(' . implode(' OR ', $expressions) . ')';
029⫶ }
030⫶}


code_samples/search/custom/src/Search/FieldMapper/WebinarEventTitleFulltextFieldMapper.php

docs/search/extensibility/solr_document_field_mappers.md@59:```php
docs/search/extensibility/solr_document_field_mappers.md@60:[[= include_file('code_samples/search/custom/src/Search/FieldMapper/WebinarEventTitleFulltextFieldMapper.php') =]]
docs/search/extensibility/solr_document_field_mappers.md@61:```

001⫶<?php declare(strict_types=1);
002⫶
003⫶namespace App\Search\FieldMapper;
004⫶
005⫶use Ibexa\Contracts\Core\Persistence\Content;
006⫶use Ibexa\Contracts\Core\Persistence\Content\Handler as ContentHandler;
007⫶use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler;
008⫶use Ibexa\Contracts\Core\Search;
009⫶use Ibexa\Contracts\Solr\FieldMapper\ContentFieldMapper;
010⫶
011⫶class WebinarEventTitleFulltextFieldMapper extends ContentFieldMapper
012⫶{
013⫶ public function __construct(protected ContentHandler $contentHandler, protected LocationHandler $locationHandler)
014⫶ {
015⫶ }
016⫶
022⫶    {
023⫶ $expressions = array_map(
024⫶ fn ($value): string => 'exif_camera_manufacturer_id:"' . $this->escapeQuote((string) $value) . '"',
025⫶ $criterion->value
026⫶ );
027⫶
028⫶ return '(' . implode(' OR ', $expressions) . ')';
029⫶ }
030⫶}


code_samples/search/custom/src/Search/FieldMapper/WebinarEventTitleFulltextFieldMapper.php

docs/search/extensibility/solr_document_field_mappers.md@59:```php
docs/search/extensibility/solr_document_field_mappers.md@60:[[= include_file('code_samples/search/custom/src/Search/FieldMapper/WebinarEventTitleFulltextFieldMapper.php') =]]
docs/search/extensibility/solr_document_field_mappers.md@61:```

001⫶<?php declare(strict_types=1);
002⫶
003⫶namespace App\Search\FieldMapper;
004⫶
005⫶use Ibexa\Contracts\Core\Persistence\Content;
006⫶use Ibexa\Contracts\Core\Persistence\Content\Handler as ContentHandler;
007⫶use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as LocationHandler;
008⫶use Ibexa\Contracts\Core\Search;
009⫶use Ibexa\Contracts\Solr\FieldMapper\ContentFieldMapper;
010⫶
011⫶class WebinarEventTitleFulltextFieldMapper extends ContentFieldMapper
012⫶{
013⫶ public function __construct(protected ContentHandler $contentHandler, protected LocationHandler $locationHandler)
014⫶ {
015⫶ }
016⫶
017⫶    public function accept(Content $content)
017⫶    public function accept(Content $content): bool
018⫶    {
019⫶ // ContentType with ID 42 is webinar event
020⫶ return $content->versionInfo->contentInfo->contentTypeId == 42;
021⫶ }
022⫶
018⫶    {
019⫶ // ContentType with ID 42 is webinar event
020⫶ return $content->versionInfo->contentInfo->contentTypeId == 42;
021⫶ }
022⫶
023⫶    public function mapFields(Content $content)
023⫶    public function mapFields(Content $content): array
024⫶    {
025⫶ $mainLocationId = $content->versionInfo->contentInfo->mainLocationId;
026⫶ $location = $this->locationHandler->load($mainLocationId);
027⫶ $parentLocation = $this->locationHandler->load($location->parentId);
028⫶ $parentContentInfo = $this->contentHandler->loadContentInfo($parentLocation->contentId);
029⫶
030⫶ return [
031⫶ new Search\Field(
032⫶ 'fulltext',
033⫶ $parentContentInfo->name,
034⫶ new Search\FieldType\FullTextField()
035⫶ ),
036⫶ ];
037⫶ }
038⫶}

024⫶    {
025⫶ $mainLocationId = $content->versionInfo->contentInfo->mainLocationId;
026⫶ $location = $this->locationHandler->load($mainLocationId);
027⫶ $parentLocation = $this->locationHandler->load($location->parentId);
028⫶ $parentContentInfo = $this->contentHandler->loadContentInfo($parentLocation->contentId);
029⫶
030⫶ return [
031⫶ new Search\Field(
032⫶ 'fulltext',
033⫶ $parentContentInfo->name,
034⫶ new Search\FieldType\FullTextField()
035⫶ ),
036⫶ ];
037⫶ }
038⫶}

Download colorized diff

@mnocon mnocon merged commit 2cc5740 into add-rector-ci Aug 4, 2025
8 checks passed
@mnocon mnocon deleted the add-rector-ci-follow-up branch August 4, 2025 11:39
mnocon added a commit that referenced this pull request Aug 4, 2025
mnocon added a commit that referenced this pull request Aug 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants