Skip to content

Commit e711efb

Browse files
authored
Merge pull request #237 from dotkernel/issue-236
Issue #236: Removed unnecessary `HasLifecycleCallbacks` entity attributes
2 parents 88ef895 + f606293 commit e711efb

6 files changed

Lines changed: 9 additions & 24 deletions

File tree

src/Admin/src/Entity/Admin.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
#[ORM\Entity(repositoryClass: AdminRepository::class)]
1717
#[ORM\Table(name: "admin")]
18-
#[ORM\HasLifecycleCallbacks]
1918
#[ORM\Cache(usage: "NONSTRICT_READ_WRITE")]
2019
class Admin extends AbstractEntity implements AdminInterface
2120
{

src/Admin/src/Entity/AdminLogin.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
#[ORM\Entity(repositoryClass: AdminLoginRepository::class)]
1212
#[ORM\Table(name: 'admin_login')]
13-
#[ORM\HasLifecycleCallbacks]
1413
#[ORM\Cache(usage: "NONSTRICT_READ_WRITE")]
1514
class AdminLogin extends AbstractEntity
1615
{

src/Admin/src/Entity/AdminRole.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
#[ORM\Entity(repositoryClass: AdminRoleRepository::class)]
1212
#[ORM\Table(name: 'admin_role')]
13-
#[ORM\HasLifecycleCallbacks]
1413
#[ORM\Cache(usage: "NONSTRICT_READ_WRITE")]
1514
class AdminRole extends AbstractEntity
1615
{

test/Unit/Admin/Entity/AdminLoginTest.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
use DateTimeInterface;
88
use Doctrine\ORM\Mapping\Entity;
9-
use Doctrine\ORM\Mapping\HasLifecycleCallbacks;
109
use Doctrine\ORM\Mapping\Table;
1110
use Frontend\Admin\Entity\AdminLogin;
1211
use Frontend\Admin\Repository\AdminLoginRepository;
@@ -19,17 +18,14 @@ class AdminLoginTest extends UnitTest
1918
{
2019
public function testAnnotations(): void
2120
{
22-
$reflection = new ReflectionClass(AdminLogin::class);
23-
$entity = $reflection->getAttributes(Entity::class);
24-
$table = $reflection->getAttributes(Table::class);
25-
$hasLifecycleCallbacks = $reflection->getAttributes(HasLifecycleCallbacks::class);
21+
$reflection = new ReflectionClass(AdminLogin::class);
22+
$entity = $reflection->getAttributes(Entity::class);
23+
$table = $reflection->getAttributes(Table::class);
2624

2725
$this->assertNotEmpty($entity[0]);
2826
$this->assertNotEmpty($table[0]);
29-
$this->assertNotEmpty($hasLifecycleCallbacks[0]);
3027
$this->assertInstanceOf(ReflectionAttribute::class, $entity[0]);
3128
$this->assertInstanceOf(ReflectionAttribute::class, $table[0]);
32-
$this->assertInstanceOf(ReflectionAttribute::class, $hasLifecycleCallbacks[0]);
3329

3430
$entityArguments = $entity[0]->getArguments();
3531
$tableArguments = $table[0]->getArguments();

test/Unit/Admin/Entity/AdminRoleTest.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
use DateTimeInterface;
88
use Doctrine\ORM\Mapping\Entity;
9-
use Doctrine\ORM\Mapping\HasLifecycleCallbacks;
109
use Doctrine\ORM\Mapping\Table;
1110
use Frontend\Admin\Entity\AdminRole;
1211
use Frontend\Admin\Repository\AdminRoleRepository;
@@ -19,17 +18,14 @@ class AdminRoleTest extends UnitTest
1918
{
2019
public function testAnnotations(): void
2120
{
22-
$reflection = new ReflectionClass(AdminRole::class);
23-
$entity = $reflection->getAttributes(Entity::class);
24-
$table = $reflection->getAttributes(Table::class);
25-
$hasLifecycleCallbacks = $reflection->getAttributes(HasLifecycleCallbacks::class);
21+
$reflection = new ReflectionClass(AdminRole::class);
22+
$entity = $reflection->getAttributes(Entity::class);
23+
$table = $reflection->getAttributes(Table::class);
2624

2725
$this->assertNotEmpty($entity[0]);
2826
$this->assertNotEmpty($table[0]);
29-
$this->assertNotEmpty($hasLifecycleCallbacks[0]);
3027
$this->assertInstanceOf(ReflectionAttribute::class, $entity[0]);
3128
$this->assertInstanceOf(ReflectionAttribute::class, $table[0]);
32-
$this->assertInstanceOf(ReflectionAttribute::class, $hasLifecycleCallbacks[0]);
3329

3430
$entityArguments = $entity[0]->getArguments();
3531
$tableArguments = $table[0]->getArguments();

test/Unit/Admin/Entity/AdminTest.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use DateTimeInterface;
88
use Doctrine\Common\Collections\ArrayCollection;
99
use Doctrine\ORM\Mapping\Entity;
10-
use Doctrine\ORM\Mapping\HasLifecycleCallbacks;
1110
use Doctrine\ORM\Mapping\Table;
1211
use Frontend\Admin\Entity\Admin;
1312
use Frontend\Admin\Entity\AdminRole;
@@ -39,17 +38,14 @@ protected function setUp(): void
3938

4039
public function testAnnotations(): void
4140
{
42-
$reflection = new ReflectionClass(Admin::class);
43-
$entity = $reflection->getAttributes(Entity::class);
44-
$table = $reflection->getAttributes(Table::class);
45-
$hasLifecycleCallbacks = $reflection->getAttributes(HasLifecycleCallbacks::class);
41+
$reflection = new ReflectionClass(Admin::class);
42+
$entity = $reflection->getAttributes(Entity::class);
43+
$table = $reflection->getAttributes(Table::class);
4644

4745
$this->assertNotEmpty($entity[0]);
4846
$this->assertNotEmpty($table[0]);
49-
$this->assertNotEmpty($hasLifecycleCallbacks[0]);
5047
$this->assertInstanceOf(ReflectionAttribute::class, $entity[0]);
5148
$this->assertInstanceOf(ReflectionAttribute::class, $table[0]);
52-
$this->assertInstanceOf(ReflectionAttribute::class, $hasLifecycleCallbacks[0]);
5349

5450
$entityArguments = $entity[0]->getArguments();
5551
$tableArguments = $table[0]->getArguments();

0 commit comments

Comments
 (0)