Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Improve DocBlock annotations of generated entities #498

Merged
merged 1 commit into from over 1 year ago

3 participants

Markus Lanthaler doctrinebot Guilherme Blanco
Markus Lanthaler

Currently, the DocBlock annotations for member variables contain the variable name as description which is redundant and should be removed. Furthermore the class is annotated with the FQN instead of just the name. This makes automatically generated documentation quite ugly.

These changes will result in entities that as follows

/**
 * User
 *
 * @ORM\Table()
 * @ORM\Entity
 */
class User
{
    /**
     * @var string
     *
     * @ORM\Column(name="name", type="string", length=255)
     */
    private $name;

instead of this:

/**
 * Some\Completely\Random\Namespace\User    <--- FQN is not needed here
 *
 * @ORM\Table()
 * @ORM\Entity
 */
class User
{
    /**
     * @var string $name  <--- description is better left blank instead of using variable name
     *
     * @ORM\Column(name="name", type="string", length=255)
     */
    private $name;
Markus Lanthaler lanthaler Improve DocBlock annotations of generated entities
Currently, the DocBlock annotations for member variables contain the variable name as description which is redundant and should be removed. Furthermore the class is annotated with the FQN instead of just the name. This makes automatically generated documentation quite ugly.
1b7ca67
doctrinebot
Collaborator

Hello,

thank you for positing this Pull Request. I have automatically opened an issue on our Jira Bug Tracker for you with the details of this Pull-Request. See the Link:

http://doctrine-project.org/jira/browse/DDC-2116

Guilherme Blanco guilhermeblanco merged commit 515847b into from
Markus Lanthaler lanthaler deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Nov 02, 2012
Markus Lanthaler lanthaler Improve DocBlock annotations of generated entities
Currently, the DocBlock annotations for member variables contain the variable name as description which is redundant and should be removed. Furthermore the class is annotated with the FQN instead of just the name. This makes automatically generated documentation quite ugly.
1b7ca67
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 2 additions and 2 deletions. Show diff stats Hide diff stats

  1. +2 2 lib/Doctrine/ORM/Tools/EntityGenerator.php
4 lib/Doctrine/ORM/Tools/EntityGenerator.php
@@ -672,7 +672,7 @@ private function generateEntityDocBlock(ClassMetadataInfo $metadata)
672 672 {
673 673 $lines = array();
674 674 $lines[] = '/**';
675   - $lines[] = ' * '.$metadata->name;
  675 + $lines[] = ' * ' . $this->getClassName($metadata);
676 676
677 677 if ($this->generateAnnotations) {
678 678 $lines[] = ' *';
@@ -1126,7 +1126,7 @@ private function generateFieldMappingPropertyDocBlock(array $fieldMapping, Class
1126 1126 {
1127 1127 $lines = array();
1128 1128 $lines[] = $this->spaces . '/**';
1129   - $lines[] = $this->spaces . ' * @var ' . $this->getType($fieldMapping['type']) . ' $' . $fieldMapping['fieldName'];
  1129 + $lines[] = $this->spaces . ' * @var ' . $this->getType($fieldMapping['type']);
1130 1130
1131 1131 if ($this->generateAnnotations) {
1132 1132 $lines[] = $this->spaces . ' *';

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.