Skip to content

Commit 203b2bd

Browse files
authored
Merge pull request #19 from toooni/feature/attributes
Feature/attributes
2 parents d359cf2 + 3853ca7 commit 203b2bd

File tree

67 files changed

+853
-1141
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+853
-1141
lines changed

.github/workflows/symfony.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313
strategy:
1414
matrix:
15-
php-version: [7.4, 8.0]
15+
php-version: [8.0]
1616
deps: ["low","default"]
1717
env:
1818
XDEBUG_MODE: coverage

Annotation/Change.php

Lines changed: 0 additions & 24 deletions
This file was deleted.

Annotation/Create.php

Lines changed: 0 additions & 26 deletions
This file was deleted.

Annotation/Delete.php

Lines changed: 0 additions & 26 deletions
This file was deleted.

Annotation/Update.php

Lines changed: 0 additions & 32 deletions
This file was deleted.

Attribute/Change.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
namespace W3C\LifecycleEventsBundle\Attribute;
4+
5+
use W3C\LifecycleEventsBundle\Event\Definitions\LifecycleEvents;
6+
use W3C\LifecycleEventsBundle\Event\LifecyclePropertyChangedEvent;
7+
8+
/**
9+
* @author Jean-Guilhem Rouel <jean-gui@w3.org>
10+
*/
11+
#[\Attribute(\Attribute::TARGET_PROPERTY)]
12+
class Change
13+
{
14+
public function __construct(
15+
public string $event = LifecycleEvents::PROPERTY_CHANGED,
16+
public string $class = LifecyclePropertyChangedEvent::class,
17+
/**
18+
* @deprecated to be removed in next major version and the class will always act as if it was set to true
19+
*/
20+
public bool $monitor_owning = false
21+
){}
22+
}

Attribute/Create.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace W3C\LifecycleEventsBundle\Attribute;
4+
5+
use W3C\LifecycleEventsBundle\Event\Definitions\LifecycleEvents;
6+
use W3C\LifecycleEventsBundle\Event\LifecycleEvent;
7+
8+
/**
9+
* @author Jean-Guilhem Rouel <jean-gui@w3.org>
10+
*/
11+
#[\Attribute(\Attribute::TARGET_CLASS)]
12+
class Create
13+
{
14+
public function __construct(
15+
public string $event = LifecycleEvents::CREATED,
16+
public string $class = LifecycleEvent::class,
17+
){}
18+
}

Attribute/Delete.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
namespace W3C\LifecycleEventsBundle\Attribute;
4+
5+
use W3C\LifecycleEventsBundle\Event\Definitions\LifecycleEvents;
6+
use W3C\LifecycleEventsBundle\Event\LifecycleDeletionEvent;
7+
8+
/**
9+
* @author Jean-Guilhem Rouel <jean-gui@w3.org>
10+
*/
11+
#[\Attribute(\Attribute::TARGET_CLASS)]
12+
class Delete
13+
{
14+
public function __construct(
15+
public string $event = LifecycleEvents::DELETED,
16+
public string $class = LifecycleDeletionEvent::class,
17+
){}
18+
}
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
<?php
22

3-
namespace W3C\LifecycleEventsBundle\Annotation;
3+
namespace W3C\LifecycleEventsBundle\Attribute;
44

55
/**
6-
* @Annotation
7-
* @Target("PROPERTY")
8-
*
96
* @author Jean-Guilhem Rouel <jean-gui@w3.org>
107
*/
8+
#[\Attribute(\Attribute::TARGET_PROPERTY)]
119
class IgnoreClassUpdates
1210
{
1311
}

Attribute/Update.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
namespace W3C\LifecycleEventsBundle\Attribute;
4+
5+
use W3C\LifecycleEventsBundle\Event\Definitions\LifecycleEvents;
6+
use W3C\LifecycleEventsBundle\Event\LifecycleUpdateEvent;
7+
8+
/**
9+
* @author Jean-Guilhem Rouel <jean-gui@w3.org>
10+
*/
11+
#[\Attribute(\Attribute::TARGET_CLASS)]
12+
class Update
13+
{
14+
public function __construct(
15+
public string $event = LifecycleEvents::UPDATED,
16+
public string $class = LifecycleUpdateEvent::class,
17+
public bool $monitor_collections = true,
18+
public bool $monitor_owning = false,
19+
){}
20+
}

0 commit comments

Comments
 (0)