DDC-356: [Patch] Driver refactoring, part 1 #443

Closed
opened 2026-01-22 12:38:26 +01:00 by admin · 3 comments
Owner

Originally created by @doctrinebot on GitHub (Feb 20, 2010).

Jira issue originally created by user shurakai:

This patch introduces a new class: AbstractMappingFileDriver. This allows us to let AnnotationDriver just as PhpDriver extend the AbstractFileDriver, which results in less code repeated.

Furthermore, there is another abstract method in AbstractFileDriver : _fileToClassName which allows us to remove parts of duplicated code that only existed because a single line had to be inserted.

Other changes / fixes: MappingException methodcalls have been renamed as they didn't exist.

(PS: My phpunit seems to be utterly broken, I get lots of errors within TestCases running on a freshly checked out workingcopy that Roman said were working for him. I could only partly run the testsuite on the changes, so it would be good if someone could exec them. I'll try and fix this soon, but I cannot promise to as my time is currently cut short. Therefore, I decided to submit this patch now.)

Originally created by @doctrinebot on GitHub (Feb 20, 2010). Jira issue originally created by user shurakai: This patch introduces a new class: AbstractMappingFileDriver. This allows us to let AnnotationDriver just as PhpDriver extend the AbstractFileDriver, which results in less code repeated. Furthermore, there is another abstract method in AbstractFileDriver : _fileToClassName which allows us to remove parts of duplicated code that only existed because a single line had to be inserted. Other changes / fixes: MappingException methodcalls have been renamed as they didn't exist. (PS: My phpunit seems to be utterly broken, I get lots of errors within TestCases running on a freshly checked out workingcopy that Roman said were working for him. I could only partly run the testsuite on the changes, so it would be good if someone could exec them. I'll try and fix this soon, but I cannot promise to as my time is currently cut short. Therefore, I decided to submit this patch now.)
admin added the Improvement label 2026-01-22 12:38:26 +01:00
admin closed this issue 2026-01-22 12:38:27 +01:00
Author
Owner

@doctrinebot commented on GitHub (Feb 21, 2010):

Comment created by romanb:

We actually had such an implementation before but decided in favor of some code duplication instead of another level of abstraction.

Also by definition a FileDriver is meant to be a metadata driver that reads the metadata from (separate) mapping files, not php class files. (thus the annotation driver is not a file driver)

What problems do you have with the unit tests? What version of phpunit? I think you need at least phpunit 3.4.0 or later.

The MappingException fixes can be applied as is. Thanks! If you have another suggestion for removing the duplicated code parts without another level of inheritance/abstraction just shoot.

@doctrinebot commented on GitHub (Feb 21, 2010): Comment created by romanb: We actually had such an implementation before but decided in favor of some code duplication instead of another level of abstraction. Also by definition a FileDriver is meant to be a metadata driver that reads the metadata from (separate) mapping files, not php class files. (thus the annotation driver is not a file driver) What problems do you have with the unit tests? What version of phpunit? I think you need at least phpunit 3.4.0 or later. The MappingException fixes can be applied as is. Thanks! If you have another suggestion for removing the duplicated code parts without another level of inheritance/abstraction just shoot.
Author
Owner

@doctrinebot commented on GitHub (Mar 20, 2010):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Mar 20, 2010): Issue was closed with resolution "Fixed"
Author
Owner

@doctrinebot commented on GitHub (Dec 13, 2015):

Imported 1 attachments from Jira into https://gist.github.com/ba56833e1c8fdeee5830

@doctrinebot commented on GitHub (Dec 13, 2015): Imported 1 attachments from Jira into https://gist.github.com/ba56833e1c8fdeee5830 - [10379_DriverRefactoringPart1.patch](https://gist.github.com/ba56833e1c8fdeee5830#file-10379_DriverRefactoringPart1-patch)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#443