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

Remove support for PHPDriver #9277

Closed
beberlei opened this issue Dec 20, 2021 · 6 comments · Fixed by #9308
Closed

Remove support for PHPDriver #9277

beberlei opened this issue Dec 20, 2021 · 6 comments · Fixed by #9308

Comments

@beberlei
Copy link
Member

beberlei commented Dec 20, 2021

Q A
New Feature yes
RFC no
BC Break yes/

Summary

We should deprecate and remove the PHPDriver, because using a magic variable $metadata in a file is confusing and the StaticPHPDriver offers a better API with a method on the entity. This will reduce the amount of test-code we have to maintain significantly.

Users can use the orm:convert-mapping command in the 2.* branches to move to another mapping driver without great effort.

In addition if they want to stay with programmatic metadata configuration, StaticPHPDriver could be used in a simple way to keep the old mapping:

class City
{
    public static function loadMetadata(ClassMetadata $metadata)
    {
        include "path/to/mapping/City.php";
    }
}
@darthf1
Copy link

darthf1 commented Jan 4, 2022

Let me start by saying that I completely understand why wou would want to remove/delete this, when having the StaticPHPDriver as an alternative.

In my codebase, I'm having my domain code and infrastructure code separate. This means that my domain model lives in my Domain namespace, and if that model is also a doctrine entity, theres a domain.model.php in my Infrastructure namespace somewhere with the magic $metadata variable.

Reading the documentation of the StaticPHPDriver, the loadMetadata function needs to reside inside the entity class, which means it wont be possible to separate these two anymore (with php).

Whilst deprecating/removing the PHPDriver, is it possible to allow the separation of the entity and the mapping for the StaticPHPDriver?

derrabus pushed a commit that referenced this issue Jan 6, 2022
* [GH-9277] Deprecate PHPDriver

* Update UPGRADE.md, fix wrong parameter

* Copy docblock to appease confused Psalm

* Talk about alternatives more
derrabus pushed a commit that referenced this issue Jan 6, 2022
* Remove deprecated PHPDriver mapping driver, use StaticPHPDriver instead.

* Update docs

* Housekeeping

* Update UPGRADE.md
derrabus added a commit to derrabus/orm that referenced this issue Jan 9, 2022
* 2.11.x:
  PHPStan 1.3.3, Psalm 4.18.1
  Remove Psalm job for analyzing DBAL 2
  Use the readonly annotation (doctrine#9340)
  Add support for custom types with requireSQLConversion and ResultSetMappingBuilder::generateSelectClause()
  PSR-6 second level cache
  Fix type errors in AbstractQuery and QueryBuilder (doctrine#9275)
  Mark columnName as always set
  Add support for PHP 8.1 enums.
  Remove ignore rules for issues fixed upstream (doctrine#9336)
  [doctrineGH-9277] deprecate php driver (doctrine#9309)
derrabus added a commit to derrabus/orm that referenced this issue Jan 9, 2022
* 2.11.x:
  PHPStan 1.3.3, Psalm 4.18.1
  Remove Psalm job for analyzing DBAL 2
  Use the readonly annotation (doctrine#9340)
  Add support for custom types with requireSQLConversion and ResultSetMappingBuilder::generateSelectClause()
  PSR-6 second level cache
  Fix type errors in AbstractQuery and QueryBuilder (doctrine#9275)
  Mark columnName as always set
  Add support for PHP 8.1 enums.
  Remove ignore rules for issues fixed upstream (doctrine#9336)
  [doctrineGH-9277] deprecate php driver (doctrine#9309)
derrabus added a commit to derrabus/orm that referenced this issue Jan 9, 2022
* 2.11.x:
  PHPStan 1.3.3, Psalm 4.18.1
  Remove Psalm job for analyzing DBAL 2
  Use the readonly annotation (doctrine#9340)
  Add support for custom types with requireSQLConversion and ResultSetMappingBuilder::generateSelectClause()
  PSR-6 second level cache
  Fix type errors in AbstractQuery and QueryBuilder (doctrine#9275)
  Mark columnName as always set
  Add support for PHP 8.1 enums.
  Remove ignore rules for issues fixed upstream (doctrine#9336)
  [doctrineGH-9277] deprecate php driver (doctrine#9309)
@morphles
Copy link

Just out of curiosity, cause it seems just super counterproductive to me (and even other drivers too), @darthf1 why would you want to separate mapping from entity?

@beberlei
Copy link
Member Author

@darthf1 the alternative is to use the XML driver.

@ahundiak
Copy link

Kind of a shame that the PHPDriver is going away. One thing it allowed was to group the mapping files into one directory while at the same time the entities could live wherever they wanted. You could organize your code by feature. And yes putting your entities in entity specific directories is the norm but it is a bit restrictive.

Looking forward to ORM 3's release. Maybe some clever coder can tweak the xml mapping stuff to support php thus removing the testing burden from the core group.

@morphles
Copy link

IMO StaticPHP is undoubtedly best driver of them all. Not needlessly separating definitions, allowing to use basic PHP stuff, like constant for discriminator map etc. Not needing to learn/know some new format. All round way better than anything else, just documentation sucks. :(

@derrabus
Copy link
Member

Closed via #9309, #9308.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants