Skip to content

Conversation

@OskarStark
Copy link
Contributor

@OskarStark OskarStark commented Nov 28, 2025

Q A
Bug fix? no
New feature? no
Docs? no
Issues --
License MIT

Needs

@OskarStark OskarStark requested review from javiereguiluz and removed request for chr-hertel November 28, 2025 07:17
@carsonbot carsonbot changed the title Use Symfony 7.4 for demo, examples and ai.symfony.com Use Symfony 7.4 for demo, examples and ai.symfony.com Nov 28, 2025
Copy link
Member

@javiereguiluz javiereguiluz left a comment

Choose a reason for hiding this comment

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

Thanks Oskar!

@chr-hertel
Copy link
Member

do we want to commit or add to gitignore?

image

@javiereguiluz
Copy link
Member

The recommendation is to commit those reference.php files.

nicolas-grekas added a commit to symfony/symfony that referenced this pull request Dec 5, 2025
…rStark)

This PR was squashed before being merged into the 7.4 branch.

Discussion
----------

[Config] Fix array shape generation for backed enums

| Q             | A
| ------------- | ---
| Branch?       | 7.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | --
| License       | MIT

Spotted in symfony/ai#1013 ➡️ https://github.com/symfony/ai/actions/runs/19780810683/job/56680686767?pr=1013

It works for `redis`, but not for `postgres`, because `redis` is using `->values(Distance::cases())` and `postgres` is using `->enumFqcn(PostgresDistance::class)`:

### Redis

#### Enum
```php
enum Distance: string
{
    use Comparable;

    case Cosine = 'COSINE';
    case L2 = 'L2';
    case Ip = 'IP';
}
```
#### Config
```php
->enumNode('distance')
    ->info('Distance metric to use for vector similarity search')
    ->values(Distance::cases())
    ->defaultValue(Distance::Cosine)
->end()
```
#### RESULT
```php
 *         redis?: array<string, array{ // Default: []
 *             connection_parameters?: mixed, // see https://github.com/phpredis/phpredis?tab=readme-ov-file#example-1
 *             client?: string, // a service id of a Redis client
 *             index_name: string,
 *             key_prefix?: string, // Default: "vector:"
 *             distance?: \Symfony\AI\Store\Bridge\Redis\Distance::Cosine|\Symfony\AI\Store\Bridge\Redis\Distance::L2|\Symfony\AI\Store\Bridge\Redis\Distance::Ip, // Distance metric to use for vector similarity search // Default: "COSINE"
 *         }>,
```

### Postgres

#### Enum
```php
enum Distance: string
{
    use Comparable;

    case Cosine = 'cosine';
    case InnerProduct = 'inner_product';
    case L1 = 'l1';
    case L2 = 'l2';

    public function getComparisonSign(): string
    {
        return match ($this) {
            self::Cosine => '<=>',
            self::InnerProduct => '<#>',
            self::L1 => '<+>',
            self::L2 => '<->',
        };
    }
}
```
#### Config
```php
->enumNode('distance')
    ->info('Distance metric to use for vector similarity search')
    ->enumFqcn(PostgresDistance::class)
    ->defaultValue(PostgresDistance::L2)
->end()
```
#### RESULT
```php
 *         postgres?: array<string, array{ // Default: []
 *             dsn?: string,
 *             username?: string,
 *             password?: string,
 *             table_name: string,
 *             vector_field?: string,
 *             distance?: cosine|inner_product|l1|l2, // Distance metric to use for vector similarity search // Default: "l2"
 *             dbal_connection?: string,
 *         }>,
```

you can see, that the result is different:
FQCN:
`distance?: \Symfony\AI\Store\Bridge\Redis\Distance::Cosine|\Symfony\AI\Store\Bridge\Redis\Distance::L2|\Symfony\AI\Store\Bridge\Redis\Distance::Ip,`
vs. strings:
`distance?: cosine|inner_product|l1|l2,`

Why?

Commits
-------

62422c4 [Config] Fix array shape generation for backed enums
symfony-splitter pushed a commit to symfony/config that referenced this pull request Dec 5, 2025
…rStark)

This PR was squashed before being merged into the 7.4 branch.

Discussion
----------

[Config] Fix array shape generation for backed enums

| Q             | A
| ------------- | ---
| Branch?       | 7.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | --
| License       | MIT

Spotted in symfony/ai#1013 ➡️ https://github.com/symfony/ai/actions/runs/19780810683/job/56680686767?pr=1013

It works for `redis`, but not for `postgres`, because `redis` is using `->values(Distance::cases())` and `postgres` is using `->enumFqcn(PostgresDistance::class)`:

### Redis

#### Enum
```php
enum Distance: string
{
    use Comparable;

    case Cosine = 'COSINE';
    case L2 = 'L2';
    case Ip = 'IP';
}
```
#### Config
```php
->enumNode('distance')
    ->info('Distance metric to use for vector similarity search')
    ->values(Distance::cases())
    ->defaultValue(Distance::Cosine)
->end()
```
#### RESULT
```php
 *         redis?: array<string, array{ // Default: []
 *             connection_parameters?: mixed, // see https://github.com/phpredis/phpredis?tab=readme-ov-file#example-1
 *             client?: string, // a service id of a Redis client
 *             index_name: string,
 *             key_prefix?: string, // Default: "vector:"
 *             distance?: \Symfony\AI\Store\Bridge\Redis\Distance::Cosine|\Symfony\AI\Store\Bridge\Redis\Distance::L2|\Symfony\AI\Store\Bridge\Redis\Distance::Ip, // Distance metric to use for vector similarity search // Default: "COSINE"
 *         }>,
```

### Postgres

#### Enum
```php
enum Distance: string
{
    use Comparable;

    case Cosine = 'cosine';
    case InnerProduct = 'inner_product';
    case L1 = 'l1';
    case L2 = 'l2';

    public function getComparisonSign(): string
    {
        return match ($this) {
            self::Cosine => '<=>',
            self::InnerProduct => '<#>',
            self::L1 => '<+>',
            self::L2 => '<->',
        };
    }
}
```
#### Config
```php
->enumNode('distance')
    ->info('Distance metric to use for vector similarity search')
    ->enumFqcn(PostgresDistance::class)
    ->defaultValue(PostgresDistance::L2)
->end()
```
#### RESULT
```php
 *         postgres?: array<string, array{ // Default: []
 *             dsn?: string,
 *             username?: string,
 *             password?: string,
 *             table_name: string,
 *             vector_field?: string,
 *             distance?: cosine|inner_product|l1|l2, // Distance metric to use for vector similarity search // Default: "l2"
 *             dbal_connection?: string,
 *         }>,
```

you can see, that the result is different:
FQCN:
`distance?: \Symfony\AI\Store\Bridge\Redis\Distance::Cosine|\Symfony\AI\Store\Bridge\Redis\Distance::L2|\Symfony\AI\Store\Bridge\Redis\Distance::Ip,`
vs. strings:
`distance?: cosine|inner_product|l1|l2,`

Why?

Commits
-------

62422c43483 [Config] Fix array shape generation for backed enums
@chr-hertel
Copy link
Member

Blocked by symfony/symfony patch release.

@chr-hertel chr-hertel added the Blocked This PR is currently blocked by another topic. label Dec 7, 2025
@OskarStark
Copy link
Contributor Author

Blocked by symfony/symfony patch release.

7.4.1 just out now

@OskarStark OskarStark force-pushed the symfony-7.4-requirement branch from 78c9b68 to f8a10c9 Compare December 7, 2025 16:13
@OskarStark OskarStark closed this Dec 7, 2025
@OskarStark OskarStark reopened this Dec 7, 2025
@OskarStark OskarStark force-pushed the symfony-7.4-requirement branch from f8a10c9 to dd8ff21 Compare December 7, 2025 21:29
Update all Symfony component requirements from 7.3 to 7.4 across demo,
examples, ai.symfony.com, root composer.json, and GitHub workflow files.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@OskarStark OskarStark force-pushed the symfony-7.4-requirement branch from dd8ff21 to ab840cc Compare December 7, 2025 21:29
@OskarStark OskarStark merged commit c677816 into symfony:main Dec 7, 2025
13 checks passed
@OskarStark OskarStark deleted the symfony-7.4-requirement branch December 7, 2025 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Blocked This PR is currently blocked by another topic. Status: Reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants