Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wire EntityArgumentResolver when available #1554

Merged
merged 1 commit into from
Sep 7, 2022

Conversation

nicolas-grekas
Copy link
Member

@nicolas-grekas nicolas-grekas commented Aug 18, 2022

Wires symfony/symfony#43854 by adding a new configuration node.

The default is:

doctrine:
  orm:
    controller_resolver:
      enabled: true
      auto_mapping: true
      evict_cache: false

Resources/config/orm.xml Outdated Show resolved Hide resolved
@nicolas-grekas nicolas-grekas force-pushed the entity-arg-resolver branch 4 times, most recently from 7c743f7 to d91c5a7 Compare August 19, 2022 12:42
@nicolas-grekas
Copy link
Member Author

PR rebased, green, thus ready.

@ostrolucky ostrolucky merged commit 71d6411 into doctrine:2.7.x Sep 7, 2022
@nicolas-grekas nicolas-grekas deleted the entity-arg-resolver branch October 12, 2022 15:32
@derrabus derrabus added this to the 2.7.1 milestone Nov 1, 2022
nicolas-grekas added a commit to symfony/symfony that referenced this pull request Nov 9, 2022
… than `EntityValueResolver` (kbond)

This PR was merged into the 6.2 branch.

Discussion
----------

[SecurityBundle] Set `UserValueResolver`'s priority higher than `EntityValueResolver`

| Q             | A
| ------------- | ---
| Branch?       | 6.2
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | n/a
| License       | MIT
| Doc PR        | n/a

`UserValueResolver`'s priority is currently `40` and `EntityValueResolver`'s priority is `110` (configured in doctrine-bundle).

Currently, to use the `CurrentUser` attribute and `MapEntity` (when `auto_mapping` is enabled), you need to do the following to have it work:

```php
public function postAction(
  #[CurrentUser]
  #[MapEntity(disabled: true)]
  User $user,
  Post $post
)
```

This removes this need for `#[MapEntity(disabled: true)]` but I'm not sure the larger impact of increasing the priority of `UserValueResolver`. Here is some context as to why the priorities are they way they are:
- doctrine/DoctrineBundle#1554 (comment)
- #18510

Commits
-------

48499b9 Set `UserValueResolver`'s priority higher than `EntityValueResolver`
symfony-splitter pushed a commit to symfony/security-bundle that referenced this pull request Nov 9, 2022
… than `EntityValueResolver` (kbond)

This PR was merged into the 6.2 branch.

Discussion
----------

[SecurityBundle] Set `UserValueResolver`'s priority higher than `EntityValueResolver`

| Q             | A
| ------------- | ---
| Branch?       | 6.2
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | n/a
| License       | MIT
| Doc PR        | n/a

`UserValueResolver`'s priority is currently `40` and `EntityValueResolver`'s priority is `110` (configured in doctrine-bundle).

Currently, to use the `CurrentUser` attribute and `MapEntity` (when `auto_mapping` is enabled), you need to do the following to have it work:

```php
public function postAction(
  #[CurrentUser]
  #[MapEntity(disabled: true)]
  User $user,
  Post $post
)
```

This removes this need for `#[MapEntity(disabled: true)]` but I'm not sure the larger impact of increasing the priority of `UserValueResolver`. Here is some context as to why the priorities are they way they are:
- doctrine/DoctrineBundle#1554 (comment)
- symfony/symfony#18510

Commits
-------

48499b99c4 Set `UserValueResolver`'s priority higher than `EntityValueResolver`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants