Skip to content

Commit fdc0802

Browse files
authored
Merge pull request #11 from ingenerator/2.x-attributes
[BREAKING] Use doctrine annotations instead of attributes for entity metadata
2 parents 115e51e + 1455baa commit fdc0802

File tree

2 files changed

+19
-12
lines changed

2 files changed

+19
-12
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
### Unreleased
22

3+
* [BREAKING] Use doctrine attributes instead of annotations for entity metadata
4+
35
### v1.5.0 (2024-10-01)
46

57
* Support PHP 8.3

src/Entity/ContentSnippet.php

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,49 +7,54 @@
77
namespace Ingenerator\ContentSnippets\Entity;
88

99

10-
/**
11-
* @Entity
12-
* @ChangeTrackingPolicy("DEFERRED_EXPLICIT")
13-
* @Table(name="content_snippets")
14-
*/
10+
use Doctrine\DBAL\Types\Types;
11+
use Doctrine\ORM\Mapping\ChangeTrackingPolicy;
12+
use Doctrine\ORM\Mapping\Column;
13+
use Doctrine\ORM\Mapping\Entity;
14+
use Doctrine\ORM\Mapping\Id;
15+
use Doctrine\ORM\Mapping\Table;
16+
17+
#[Entity]
18+
#[ChangeTrackingPolicy('DEFERRED_EXPLICIT')]
19+
#[Table(name: 'content_snippets')]
1520
class ContentSnippet
1621
{
1722

1823
/**
1924
* @var string
20-
* @Id
21-
* @Column(type="string")
2225
*/
26+
#[Id]
27+
#[Column(type: Types::STRING)]
2328
protected $slug;
2429

2530
/**
2631
* @var string
27-
* @Column(type="string")
2832
*/
33+
#[Column(type: Types::STRING)]
2934
protected $display_name;
3035

3136
/**
3237
* @var string
33-
* @Column(type="text", nullable=true)
3438
*/
39+
#[Column(type: Types::TEXT, nullable: TRUE)]
3540
protected $help_text;
3641

3742
/**
3843
* @var bool
39-
* @Column(type="boolean")
4044
*/
45+
#[Column(type: Types::BOOLEAN)]
4146
protected $allows_html;
4247

4348
/**
4449
* @var string
45-
* @Column(type="text", nullable=true)
4650
*/
51+
#[Column(type: Types::TEXT, nullable: TRUE)]
4752
protected $content;
4853

4954
/**
5055
* @var \DateTimeImmutable
51-
* @Column(type="datetime_immutable")
5256
*/
57+
#[Column(type: Types::DATETIME_IMMUTABLE)]
5358
protected $updated_at;
5459

5560
/**

0 commit comments

Comments
 (0)