Skip to content

Commit

Permalink
Merge pull request #1407 from aivus/patch-1
Browse files Browse the repository at this point in the history
Add return to removeMethodTemplate
  • Loading branch information
Ocramius committed Nov 7, 2015
2 parents e7685c8 + 60b80c9 commit 28cebec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion lib/Doctrine/ORM/Tools/EntityGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,12 @@ public function <methodName>(<methodTypeHint>$<variableName>)
* <description>
*
* @param <variableType> $<variableName>
*
* @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
*/
public function <methodName>(<methodTypeHint>$<variableName>)
{
<spaces>$this-><fieldName>->removeElement($<variableName>);
<spaces>return $this-><fieldName>->removeElement($<variableName>);
}';

/**
Expand Down
6 changes: 4 additions & 2 deletions tests/Doctrine/Tests/ORM/Tools/EntityGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,10 @@ public function testGeneratedEntityClass()
$this->assertEquals($author, $book->getAuthor());

$comment = new EntityGeneratorComment();
$book->addComment($comment);
$this->assertInstanceOf($metadata->name, $book->addComment($comment));
$this->assertInstanceOf('Doctrine\Common\Collections\ArrayCollection', $book->getComments());
$this->assertEquals(new \Doctrine\Common\Collections\ArrayCollection(array($comment)), $book->getComments());
$book->removeComment($comment);
$this->assertInternalType('boolean', $book->removeComment($comment));
$this->assertEquals(new \Doctrine\Common\Collections\ArrayCollection(array()), $book->getComments());

$this->newInstance($isbnMetadata);
Expand Down Expand Up @@ -362,7 +362,9 @@ public function testMethodDocBlockShouldStartWithBackSlash()
$this->assertPhpDocVarType('\Doctrine\Common\Collections\Collection', new \ReflectionProperty($book, 'comments'));
$this->assertPhpDocReturnType('\Doctrine\Common\Collections\Collection', new \ReflectionMethod($book, 'getComments'));
$this->assertPhpDocParamType('\Doctrine\Tests\ORM\Tools\EntityGeneratorComment', new \ReflectionMethod($book, 'addComment'));
$this->assertPhpDocReturnType('EntityGeneratorBook', new \ReflectionMethod($book, 'addComment'));
$this->assertPhpDocParamType('\Doctrine\Tests\ORM\Tools\EntityGeneratorComment', new \ReflectionMethod($book, 'removeComment'));
$this->assertPhpDocReturnType('boolean', new \ReflectionMethod($book, 'removeComment'));

$this->assertPhpDocVarType('\Doctrine\Tests\ORM\Tools\EntityGeneratorAuthor', new \ReflectionProperty($book, 'author'));
$this->assertPhpDocReturnType('\Doctrine\Tests\ORM\Tools\EntityGeneratorAuthor', new \ReflectionMethod($book, 'getAuthor'));
Expand Down

0 comments on commit 28cebec

Please sign in to comment.