add has lifecycle callbacks

This commit is contained in:
TomasVotruba 2020-02-25 20:46:55 +01:00
parent 945c354654
commit 788abf5131
2 changed files with 58 additions and 0 deletions

View File

@ -0,0 +1,41 @@
<?php
namespace Rector\SOLID\Tests\Rector\Class_\FinalizeClassesWithoutChildrenRector\Fixture;
use Doctrine\ORM\Mapping as ORM;
use Snowflake\Snowflake;
/**
* @ORM\HasLifecycleCallbacks
* @ORM\Table
* @ORM\Entity
*/
class Issue1639
{
/**
* @var Expense
*
* @ORM\Id
* @ORM\ManyToOne(targetEntity="Expense", inversedBy="expenseTags")
*/
private $expense;
/**
* @var Snowflake
*
* @ORM\Id
* @ORM\Column(name="tag_id", type="snowflake")
*/
private $tagId;
public function __construct(Expense $expense, Snowflake $tagId)
{
$this->expense = $expense;
$this->tagId = $tagId;
}
public function tagId(): Snowflake
{
return $this->tagId;
}
}

View File

@ -0,0 +1,17 @@
<?php
namespace Doctrine\ORM\Mapping;
// mimics @see https://github.com/doctrine/orm/blob/master/lib/Doctrine/ORM/Annotation/HasLifecycleCallbacks.php
if (class_exists('Doctrine\ORM\Mapping\HasLifecycleCallbacks')) {
return;
}
/**
* @Annotation
* @Target("CLASS")
*/
final class HasLifecycleCallbacks implements Annotation
{
}