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

抽象化レイヤー: Doctrine/Common #20

Open
kiy0taka opened this issue Apr 25, 2023 · 0 comments
Open

抽象化レイヤー: Doctrine/Common #20

kiy0taka opened this issue Apr 25, 2023 · 0 comments
Assignees

Comments

@kiy0taka
Copy link
Contributor

[done] Doctrine\Common\Annotations\AnnotationReader

以下の3箇所で利用。いずれもプラグイン拡張やインストーラに関係するもの。framework扱いでよいのでは。
https://github.com/EC-CUBE/next-poc/blob/main/src/application/Eccube/Service/SchemaService.php#L76
https://github.com/EC-CUBE/next-poc/blob/main/src/application/Eccube/Controller/Install/InstallController.php#L593
https://github.com/EC-CUBE/next-poc/blob/main/src/application/Eccube/Service/EntityProxyService.php#L187

[done] Doctrine\Common\Annotations\Reader

Eccube\Form\Extension\DoctrineOrmExtensionで利用。frameworkへ移動済のため対応不要。

[done] Doctrine\Common\Collections\ArrayCollection

対応案1)
Doctrine\Common\Collections\ArrayCollectionを継承したラッパークラスを作成し、ラッパークラスを利用するように変更。
利用箇所多し。

対応案2)
ArrayCollectionの継承クラスではなく、ArrayAccessを実装したクラスの方が仕様変更に対して安全そう。

[done] Doctrine\Common\Collections\Collection

エンティティのメソッドコメントで利用。実体はArrayCollection。
https://github.com/EC-CUBE/next-poc/blob/main/src/application/Eccube/Entity/Block.php#L87

[done] Doctrine\Common\Collections\Criteria

 $criteria->where(Criteria::expr()->lte('publish_date', new \DateTime()));

expr()はExpresionBuilder、lte()はComparisonを返す。
ComparisonやExpresionBuilderも考慮する必要がある。

対応案1) 関連クラスも含めてサブクラス化していく
対応案2) QueryBuilder等に切り出し、Criteriaを利用しない方向に持っていく

[done] Doctrine\Common\Persistence\Mapping\Driver\MappingDriver / Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain

マスターデータ管理にて、テーブル名のプルダウンを生成するために利用している。
https://github.com/EC-CUBE/next-poc/blob/main/src/application/Eccube/Form/Type/Admin/MasterdataType.php#L55

該当処理をframeworkへ関数化して切り出せばよいかと思われる。

※切り出す際はapplication側のクラスに依存しないように注意
https://github.com/EC-CUBE/next-poc/blob/main/src/application/Eccube/Form/Type/Admin/MasterdataType.php#L69

[done] Doctrine\Common\Util\ClassUtils

以下で利用
https://github.com/EC-CUBE/next-poc/blob/main/src/application/Eccube/Service/CsvExportService.php#L322

継承してframeworkに配置
->staticメソッドなので継承しても仕様変更の影響を避けられない。アダプターを作成する

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

No branches or pull requests

2 participants