Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Improve DocBlock annotations of generated entities #498

Merged
merged 1 commit into from

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
Commits on Nov 2, 2012
  1. Markus Lanthaler

    Improve DocBlock annotations of generated entities

    lanthaler authored
    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.
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/Doctrine/ORM/Tools/EntityGenerator.php
4 lib/Doctrine/ORM/Tools/EntityGenerator.php
View
@@ -672,7 +672,7 @@ private function generateEntityDocBlock(ClassMetadataInfo $metadata)
{
$lines = array();
$lines[] = '/**';
- $lines[] = ' * '.$metadata->name;
+ $lines[] = ' * ' . $this->getClassName($metadata);
if ($this->generateAnnotations) {
$lines[] = ' *';
@@ -1126,7 +1126,7 @@ private function generateFieldMappingPropertyDocBlock(array $fieldMapping, Class
{
$lines = array();
$lines[] = $this->spaces . '/**';
- $lines[] = $this->spaces . ' * @var ' . $this->getType($fieldMapping['type']) . ' $' . $fieldMapping['fieldName'];
+ $lines[] = $this->spaces . ' * @var ' . $this->getType($fieldMapping['type']);
if ($this->generateAnnotations) {
$lines[] = $this->spaces . ' *';
Something went wrong with that request. Please try again.