DDC-104: Junk annotation code generated using convert mapping #131

Closed
opened 2026-01-22 12:28:11 +01:00 by admin · 2 comments
Owner

Originally created by @doctrinebot on GitHub (Nov 2, 2009).

Originally assigned to: @jwage on GitHub.

Jira issue originally created by user rickdt:

When generating annotation from yaml
./doctrine convert-mapping --from=./yaml/ --to=annotation --dest=.

with one already generated yaml file and one new yaml file

annotation of first yaml is appended to the new annotations.

Cause of the problem is in AnnotationExporter. ($this->_currentCode is not cleared.)

public function exportClassMetadata(ClassMetadataInfo $metadata)
{
if (file_exists($this->_outputPath)) {
$this->_currentCode = file_get_contents($this->_outputPath);
}

Solution :

if (file_exists($this->_outputPath)) {
$this->_currentCode = file_get_contents($this->_outputPath);
}
else {
$this->_currentCode = '';
}

Originally created by @doctrinebot on GitHub (Nov 2, 2009). Originally assigned to: @jwage on GitHub. Jira issue originally created by user rickdt: When generating annotation from yaml ./doctrine convert-mapping --from=./yaml/ --to=annotation --dest=. with one already generated yaml file and one new yaml file annotation of first yaml is appended to the new annotations. Cause of the problem is in AnnotationExporter. ($this->_currentCode is not cleared.) public function exportClassMetadata(ClassMetadataInfo $metadata) { if (file_exists($this->_outputPath)) { $this->_currentCode = file_get_contents($this->_outputPath); } Solution : if (file_exists($this->_outputPath)) { $this->_currentCode = file_get_contents($this->_outputPath); } else { $this->_currentCode = ''; }
admin added the Bug label 2026-01-22 12:28:11 +01:00
admin closed this issue 2026-01-22 12:28:12 +01:00
Author
Owner

@doctrinebot commented on GitHub (Nov 2, 2009):

Comment created by rickdt:

This does not solve completely the issue.

Updating the same annotation class from yaml often generate junk code.

@doctrinebot commented on GitHub (Nov 2, 2009): Comment created by rickdt: This does not solve completely the issue. Updating the same annotation class from yaml often generate junk code.
Author
Owner

@doctrinebot commented on GitHub (Nov 11, 2009):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Nov 11, 2009): Issue was closed with resolution "Fixed"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#131