Skip to content

Commit

Permalink
Deprecate Yaml mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
franmomu committed Jan 1, 2022
1 parent 20570a6 commit e932700
Show file tree
Hide file tree
Showing 25 changed files with 34 additions and 585 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ a release.
- In order to use a custom cache for storing configuration of an extension, the user has to call `setCacheItemPool()`
on the extension listener passing an instance of `Psr\Cache\CacheItemPoolInterface`.

### Deprecated
- Using YAML mapping is deprecated, you SHOULD migrate to attributes or annotations.

## [3.4.0] - 2021-12-05
### Added
- PHP 8 Attributes support for Doctrine MongoDB to document & traits.
Expand Down
74 changes: 1 addition & 73 deletions doc/blameable.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Features:
- Specific attributes and annotations for properties, and no interface required
- Can react to specific property or relation changes to specific value
- Can be nested with other behaviors
- Attribute, Annotation, Yaml and Xml mapping support for extensions
- Attribute, Annotation and Xml mapping support for extensions

This article will cover the basic installation and functionality of **Blameable** behavior

Expand All @@ -31,7 +31,6 @@ Content:
- [Including](#including-extension) the extension
- Entity [example](#entity-mapping)
- Document [example](#document-mapping)
- [Yaml](#yaml-mapping) mapping example
- [Xml](#xml-mapping) mapping example
- Advanced usage [examples](#advanced-examples)
- Using [Traits](#traits)
Expand Down Expand Up @@ -371,38 +370,6 @@ class Article

Now on update and creation these annotated fields will be automatically updated

<a name="yaml-mapping"></a>

## Yaml mapping example:

Yaml mapped Article: **/mapping/yaml/Entity.Article.dcm.yml**

```
---
Entity\Article:
type: entity
table: articles
id:
id:
type: integer
generator:
strategy: AUTO
fields:
title:
type: string
length: 64
createdBy:
type: string
gedmo:
blameable:
on: create
updatedBy:
type: string
gedmo:
blameable:
on: update
```

<a name="xml-mapping"></a>

## Xml mapping example
Expand Down Expand Up @@ -572,45 +539,6 @@ class Article
}
```

Yaml mapped Article: **/mapping/yaml/Entity.Article.dcm.yml**

```
---
Entity\Article:
type: entity
table: articles
id:
id:
type: integer
generator:
strategy: AUTO
fields:
title:
type: string
length: 64
createdBy:
type: string
gedmo:
blameable:
on: create
updatedBy:
type: string
gedmo:
blameable:
on: update
publishedBy:
type: string
gedmo:
blameable:
on: change
field: type.title
value: Published
manyToOne:
type:
targetEntity: Entity\Type
inversedBy: articles
```

Now few operations to get it all done:

```php
Expand Down
84 changes: 1 addition & 83 deletions doc/ip_traceable.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Features:
- Specific attributes and annotations for properties, and no interface required
- Can react to specific property or relation changes to specific value
- Can be nested with other behaviors
- Attribute, Annotation, Yaml and Xml mapping support for extensions
- Attribute, Annotation and Xml mapping support for extensions

This article will cover the basic installation and functionality of **IpTraceable** behavior

Expand All @@ -26,7 +26,6 @@ Content:
- [Including](#including-extension) the extension
- Entity [example](#entity-mapping)
- Document [example](#document-mapping)
- [Yaml](#yaml-mapping) mapping example
- [Xml](#xml-mapping) mapping example
- Advanced usage [examples](#advanced-examples)
- Using [Traits](#traits)
Expand Down Expand Up @@ -255,42 +254,6 @@ class Article

Now on update and creation these annotated fields will be automatically updated

<a name="yaml-mapping"></a>

## Yaml mapping example:

Yaml mapped Article: **/mapping/yaml/Entity.Article.dcm.yml**

```
---
Entity\Article:
type: entity
table: articles
id:
id:
type: integer
generator:
strategy: AUTO
fields:
title:
type: string
length: 64
createdFromIp:
type: string
length: 45
nullable: true
gedmo:
ipTraceable:
on: create
updatedFromIp:
type: string
length: 45
nullable: true
gedmo:
ipTraceable:
on: update
```

<a name="xml-mapping"></a>

## Xml mapping example
Expand Down Expand Up @@ -460,51 +423,6 @@ class Article
}
```

Yaml mapped Article: **/mapping/yaml/Entity.Article.dcm.yml**

```
---
Entity\Article:
type: entity
table: articles
id:
id:
type: integer
generator:
strategy: AUTO
fields:
title:
type: string
length: 64
createdFromIp:
type: string
length: 45
nullable: true
gedmo:
ipTraceable:
on: create
updatedFromIp:
type: string
length: 45
nullable: true
gedmo:
ipTraceable:
on: update
publishedFromIp:
type: string
length: 45
nullable: true
gedmo:
ipTraceable:
on: change
field: type.title
value: Published
manyToOne:
type:
targetEntity: Entity\Type
inversedBy: articles
```

Now few operations to get it all done:

```php
Expand Down
35 changes: 1 addition & 34 deletions doc/loggable.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Features:
- ORM and ODM support using same listener
- Can be nested with other behaviors
- Objects can be reverted to previous versions
- Attributes, Annotation, Yaml and Xml mapping support for extensions
- Attributes, Annotation and Xml mapping support for extensions

This article will cover the basic installation and functionality of **Loggable**
behavior
Expand All @@ -19,7 +19,6 @@ Content:
- [Including](#including-extension) the extension
- Entity [example](#entity-mapping)
- Document [example](#document-mapping)
- [Yaml](#yaml-mapping) mapping example
- [Xml](#xml-mapping) mapping example
- Basic usage [examples](#basic-examples)

Expand Down Expand Up @@ -169,38 +168,6 @@ class Article
}
```

<a name="yaml-mapping"></a>

## Yaml mapping example

Yaml mapped Article: **/mapping/yaml/Entity.Article.dcm.yml**

```
---
Entity\Article:
type: entity
table: articles
gedmo:
loggable:
# using specific personal LogEntryClass class:
logEntryClass: My\LogEntry
# without specifying the LogEntryClass class:
# loggable: true
id:
id:
type: integer
generator:
strategy: AUTO
fields:
title:
type: string
length: 64
gedmo:
- versioned
content:
type: text
```

<a name="xml-mapping"></a>

## Xml mapping example
Expand Down
2 changes: 1 addition & 1 deletion doc/mapping.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ for different object managers like **ODM** and **ORM**.

Features:

- Mapping drivers for annotation and yaml
- Mapping drivers for annotation
- Conventional extension points for metadata extraction and object manager abstraction

- Public [Mapping repository](https://github.com/doctrine-extensions/DoctrineExtensions "Mapping extension on Github") is available on github
Expand Down
31 changes: 2 additions & 29 deletions doc/reference_integrity.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Reference Integrity behavior extension for Doctrine 2

**ReferenceIntegrity** behavior will automate the reference integrity for referenced documents.
It works through annotations and yaml, and supports 'nullify', 'pull' and 'restrict' which throws an exception.
It works through annotations and attributes, and supports 'nullify', 'pull' and 'restrict' which throws an exception.

So let's say you have a Type which is referenced to multiple Articles, when deleting the Type, by default the Article
would still have a reference to Type, since Mongo doesn't care. When setting the ReferenceIntegrity to 'nullify' it
Expand All @@ -15,15 +15,14 @@ Features:
- ODM only
- ReferenceOne and ReferenceMany support
- 'nullify', 'pull' and 'restrict' support
- Attribute, Annotation and Yaml mapping support for extensions
- Attribute and Annotation mapping support for extensions

This article will cover the basic installation and functionality of **ReferenceIntegrity** behavior

Content:

- [Including](#including-extension) the extension
- Document [example](#document-mapping)
- [Yaml](#yaml-mapping) mapping example
- Usage [examples](#advanced-examples)

<a name="including-extension"></a>
Expand Down Expand Up @@ -80,32 +79,6 @@ class Type
It is necessary to have the 'mappedBy' option set, to be able to access the referenced documents.
On removal of Type, on the referenced Article the Type reference will be nullified (removed)

<a name="yaml-mapping"></a>

## Yaml mapping example:

Yaml mapped Article: **/mapping/yaml/Documents.Article.dcm.yml**

```
---
Document\Type:
type: document
collection: types
fields:
id:
id: true
title:
type: string
article:
reference: true
type: one
mappedBy: type
targetDocument: Document\Article
gedmo:
referenceIntegrity: nullify # or pull or restrict
```

It is necessary to have the 'mappedBy' option set, to be able to access the referenced documents.

<a name="advanced-examples"></a>
Expand Down
Loading

0 comments on commit e932700

Please sign in to comment.