Skip to content

Conversation

mnocon
Copy link
Contributor

@mnocon mnocon commented Feb 11, 2025

Adds information about the latest LTS update: Date and time attribute.

Target: master, 4.6

The PR can be reviewed already, but the following things still need to be added:

  • PHP API Reference cannot be generated (package needs to be on updates.ibexa.co and needs tagged version)

Because of this, there are 2 TODOs left: links need to be added to the PHP REF.

Changes:

@mnocon mnocon changed the title Added informtion about Date and Time attribute Added information about Date and Time attribute Feb 11, 2025
@ibexa ibexa deleted a comment from github-actions bot Feb 11, 2025
@mnocon mnocon marked this pull request as ready for review February 12, 2025 08:13
@mnocon mnocon requested a review from tbialcz February 12, 2025 08:26

# DateTimeAttribute criterion

The [`DateTimeAttribute Search Criterion`](TODO: PHP REF) searches for products by value of a specified attribute, based on the [date and time attribute](date_and_time.md) type.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The [`DateTimeAttribute Search Criterion`](TODO: PHP REF) searches for products by value of a specified attribute, based on the [date and time attribute](date_and_time.md) type.
The `DateTimeAttribute Search Criterion` searches for products by value of a specified attribute, based on the [date and time attribute](date_and_time.md) type.

Ignore the comment if you have a corresponding PR open.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't generate the reference until the package is released - I will generate it and update this PR when the tagging is done with the two missing links


# DateTimeAttributeRange criterion

The [`DateTimeAttributeRange Search Criterion`](TODO: PHP REF)` searches for products by value of a specified attribute, which must be based on the [date and time attribute](date_and_time.md) type.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The [`DateTimeAttributeRange Search Criterion`](TODO: PHP REF)` searches for products by value of a specified attribute, which must be based on the [date and time attribute](date_and_time.md) type.
The `DateTimeAttributeRange Search Criterion` searches for products by value of a specified attribute, which must be based on the [date and time attribute](date_and_time.md) type.

Same comment as above - ignore if you have a corresponding PR open.

Also, redundant closing quote "`"

@mnocon
Copy link
Contributor Author

mnocon commented Mar 3, 2025

Additional changes in:

@mnocon mnocon requested a review from dabrt March 3, 2025 14:57
@github-actions
Copy link

github-actions bot commented Mar 3, 2025

code_samples/ change report

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

code_samples/back_office/search/src/Query/DateTimeAttributeQuery.php


code_samples/back_office/search/src/Query/DateTimeAttributeQuery.php

docs/search/criteria_reference/datetimeattribute_criterion.md@31:``` php
docs/search/criteria_reference/datetimeattribute_criterion.md@32:[[= include_file('code_samples/back_office/search/src/Query/DateTimeAttributeQuery.php') =]]
docs/search/criteria_reference/datetimeattribute_criterion.md@33:```

001⫶<?php declare(strict_types=1);
002⫶
003⫶use DateTimeImmutable;
004⫶use Ibexa\Contracts\CoreSearch\Values\Query\Criterion\FieldValueCriterion;
005⫶use Ibexa\Contracts\ProductCatalog\Values\Product\ProductQuery;
006⫶use Ibexa\Contracts\ProductCatalogDateTimeAttribute\Search\Criterion\DateTimeAttribute;
007⫶
008⫶$query = new ProductQuery();
009⫶$filter = new DateTimeAttribute('event_date', new DateTimeImmutable('2025-07-06'));
010⫶$filter->setOperator(FieldValueCriterion::COMPARISON_EQ);
011⫶$query->setFilter($filter);
012⫶/** @var \Ibexa\Contracts\ProductCatalog\ProductServiceInterface $productService */
013⫶$results = $productService->findProducts($query);


code_samples/back_office/search/src/Query/DateTimeAttributeRangeQuery.php


code_samples/back_office/search/src/Query/DateTimeAttributeRangeQuery.php

docs/search/criteria_reference/datetimeattributerange_criterion.md@22:``` php
docs/search/criteria_reference/datetimeattributerange_criterion.md@23:[[= include_file('code_samples/back_office/search/src/Query/DateTimeAttributeRangeQuery.php') =]]
docs/search/criteria_reference/datetimeattributerange_criterion.md@24:```

001⫶<?php declare(strict_types=1);
002⫶
003⫶use DateTimeImmutable;
004⫶use Ibexa\Contracts\ProductCatalog\Values\Product\ProductQuery;
005⫶use Ibexa\Contracts\ProductCatalogDateTimeAttribute\Search\Criterion\DateTimeAttributeRange;
006⫶
007⫶$query = new ProductQuery();
008⫶$query->setFilter(new DateTimeAttributeRange('event_date', new DateTimeImmutable('2025-01-01')));
009⫶/** @var \Ibexa\Contracts\ProductCatalog\ProductServiceInterface $productService */
010⫶$results = $productService->findProducts($query);


code_samples/data_migration/examples/create_datetime_attribute.yaml


code_samples/data_migration/examples/create_datetime_attribute.yaml

docs/content_management/data_migration/importing_data.md@353:``` yaml
docs/content_management/data_migration/importing_data.md@354:[[= include_file('code_samples/data_migration/examples/create_datetime_attribute.yaml') =]]
docs/content_management/data_migration/importing_data.md@355:```

001⫶- type: attribute
002⫶ mode: create
003⫶ identifier: event_date
004⫶ attribute_group_identifier: example
005⫶ attribute_type_identifier: datetime
006⫶ position: 1
007⫶ names:
008⫶ eng-GB: 'Event date'
009⫶ options:
010⫶ accuracy: day # One of: second, minute, day, month, trimester, year

Download colorized diff

@mnocon mnocon force-pushed the date-time-attribute branch from cde2f85 to aa7d27b Compare March 5, 2025 09:46
@mnocon mnocon merged commit 381075a into master Mar 5, 2025
5 of 7 checks passed
@mnocon mnocon deleted the date-time-attribute branch March 5, 2025 09:48
mnocon added a commit that referenced this pull request Mar 5, 2025
* Added informtion about Date and Time attribute

* PHP CS Fixes

* Fixes

* Fixes

* Image fix

* Added missing link

* Fixed code sample

* Review fixes

* Added year limitation

* Added composer package

* Apply suggestions from code review

Co-authored-by: Tomasz Dąbrowski <64841871+dabrt@users.noreply.github.com>

* Removed efficiently

* Fixed broken link placeholder

* Fixed attribute and product type casing

* Added missing links

---------

Co-authored-by: Tomasz Dąbrowski <64841871+dabrt@users.noreply.github.com>
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