-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
EntityManager::__cosntruct() as public method #1293
Conversation
- moved create() method to EntityManagerFactory class - added new Configuration class methods for UnitOfWork and ProxyFactory classes - updated documentation - updated unit and functional tests
Hello, thank you for creating this pull request. I have automatically opened an issue http://www.doctrine-project.org/jira/browse/DDC-3550 We use Jira to track the state of pull requests and the versions they got |
* @throws \InvalidArgumentException | ||
* @throws ORMException | ||
*/ | ||
public static function create($conn, Configuration $config, EventManager $eventManager = null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removing this method would an unnecesary BC Break
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As for now EntityManager has a lot of responsibilities including creation of its own instance. Separate class should prepare and instantiate EntityManager. I agree that this is backward incompatible change. The strategy might be changed based on release policy. In case 2.5.* allows to introduce this change, we are in a good shape. Alternatively, this method might marked as @deprecated since 2.5 and proxy behavior to the EntityManagerFactory
Like this:
/**
* @deprecated since 2.5
*/
public static function create($conn, Configuration $config, EventManager $eventManager = null)
{
return new EntityManagerFactory($conn, $config, $eventManager);
}
Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mcspronko BC breaks are forbidden in minor versions. Semver means that any BC break in the public API requires bumping the major version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stof so option with deprecated create() method should be ok for minor change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can mark it deprecated, but you cannot change the behaviour.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, my mistake it should be like this
/**
* @deprecated since 2.5
*/
public static function create($conn, Configuration $config, EventManager $eventManager = null)
{
return EntityManagerFactory::create($conn, $config, $eventManager);
}
where create() behavior is the same.
Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you have the new
there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TYPO :)
EntityManager::__construct() is not public by design and EntityManager::create() is the only exposed and proper way to instantiate new instance. Also EntityManager will become final in Doctrine 3.0. Valid extension point to enhance EntityManager is through decorator pattern using EntityManagerInterface, not inheritance. |
Updated EntityManager::__construct() method to public visibility: