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

Managers should only flush their entities #26

Open
alenpokos opened this issue Feb 11, 2019 · 1 comment
Open

Managers should only flush their entities #26

alenpokos opened this issue Feb 11, 2019 · 1 comment
Labels
enhancement New feature or request

Comments

@alenpokos
Copy link

Currently, any manager implemented in this bundle calls flush(), ie. Manager/Doctrine/AccessTokenManager.php:35

It would be better to flush only one created entity.

Example from \Trikoder\Bundle\OAuth2Bundle\Manager\Doctrine\AccessTokenManager

Instead of:

public function save(AccessToken $accessToken): void
    {
        $this->entityManager->persist($accessToken);
        $this->entityManager->flush();
    }

use

public function save(AccessToken $accessToken): void
    {
        $this->entityManager->persist($accessToken);
        $this->entityManager->flush($accessToken);
    }
@X-Coder264
Copy link
Collaborator

The behavior of flushing only one entity to the database via the flush method was deprecated a couple of years ago and was removed for Doctrine 3.0.

https://github.com/doctrine/orm/blob/master/UPGRADE.md#bc-break-removed-entitymanagerflushentity-and-entitymanagerflushentities

doctrine/orm#6118

@HypeMC HypeMC added the enhancement New feature or request label Mar 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants