-
-
Notifications
You must be signed in to change notification settings - Fork 261
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
3 changed files
with
106 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
tests/SimpleThings/Tests/EntityAudit/Fixtures/Issue/Issue308User.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<?php | ||
|
||
namespace SimpleThings\EntityAudit\Tests\Fixtures\Issue; | ||
|
||
use Doctrine\Common\Collections\ArrayCollection; | ||
use Doctrine\ORM\Mapping as ORM; | ||
|
||
/** | ||
* @ORM\Entity | ||
*/ | ||
class Issue308User | ||
{ | ||
/** @ORM\Id @ORM\Column(type="integer") @ORM\GeneratedValue(strategy="AUTO") */ | ||
private $id; | ||
|
||
/** | ||
* @var ArrayCollection | ||
* | ||
* @ORM\OneToMany(targetEntity="Issue308User", mappedBy="parent") | ||
*/ | ||
private $children; | ||
|
||
/** | ||
* @var Issue308User | ||
* | ||
* @ORM\ManyToOne(targetEntity="Issue308User", inversedBy="children") | ||
*/ | ||
private $parent; | ||
|
||
public function __construct() | ||
{ | ||
$this->children = new ArrayCollection(); | ||
} | ||
|
||
public function getId() | ||
{ | ||
return $this->id; | ||
} | ||
|
||
/** | ||
* @transient | ||
* | ||
* @return bool | ||
*/ | ||
public function isActive() | ||
{ | ||
return false; | ||
} | ||
|
||
/** | ||
* @param Issue308User $child | ||
*/ | ||
public function addChild(Issue308User $child) | ||
{ | ||
$this->children->add($child); | ||
} | ||
|
||
/** | ||
* @return ArrayCollection | ||
*/ | ||
public function getChildren() | ||
{ | ||
$activeChildren = $this->children->filter(function (Issue308User $user) { | ||
return $user->isActive(); | ||
}); | ||
|
||
return $activeChildren; | ||
} | ||
|
||
/** | ||
* @return Issue308User | ||
*/ | ||
public function getParent() | ||
{ | ||
return $this->parent; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters