Skip to content
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.

Commit

Permalink
Merge pull request #273 from symfony-cmf/issue-272/child-restriction
Browse files Browse the repository at this point in the history
Configure document's child restrictions
  • Loading branch information
wouterj authored Feb 10, 2017
2 parents 5cd5634 + 74750fd commit 6177f69
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Changelog

* **2017-02-10**: [BC BREAK] Removed the `ImagineBlock` as the CmfMediaBundle
is abandoned.
* **2017-02-09**: [BC BREAK] Added child restrictions to the block documents.
See the UPGRADE guide for detailed information.

2.0.0-RC1
---------
Expand Down
13 changes: 12 additions & 1 deletion UPGRADE-2.0.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Upgrade from 1.x to 2.0

## Sonata Admin
### Sonata Admin

* The SonataAdminBundle integration has been moved to
`symfony-cmf/sonata-admin-integration-bundle`. This includes the classes in
Expand Down Expand Up @@ -66,3 +66,14 @@
* The `ImagineBlock` was removed from this bundle as the CmfMediaBundle is
abandoned. Implement the block in your own application if you were using it.

### Doctrine PHPCR ODM

* It is no longer possible to add a child to the `ActionBlock`,
`ImagineBlock`, `MenuBlock`, `ReferenceBlock`, `RssBlock`, `SimpleBlock` and
`StringBlock` documents. This behaviour can be changed by overriding the
`child-class` setting of the PHPCR ODM mapping.

* Only instances of sonata's `BlockInterface` are allowed as children of the
`ContainerBlock` and `SlideshowBlock` documents. This behaviour can be changed
by overriding the `child-class` setting of the PHPCR ODM mapping.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"php": "^5.6|^7.0",
"symfony/framework-bundle": "^2.8|^3.0",
"doctrine/phpcr-bundle" :"^1.0",
"doctrine/phpcr-odm": "^1.4|^2.0",
"doctrine/phpcr-odm": "^1.4.2",
"sonata-project/block-bundle": "^3.3",
"symfony-cmf/core-bundle": "^2.0"
},
Expand Down
1 change: 1 addition & 0 deletions src/Resources/config/doctrine-phpcr/ActionBlock.phpcr.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<document
name="Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\ActionBlock"
referenceable="true"
is-leaf="true"
>

<lifecycle-callbacks>
Expand Down
2 changes: 2 additions & 0 deletions src/Resources/config/doctrine-phpcr/ContainerBlock.phpcr.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
</cascade>
</children>

<child-class name="Sonata\BlockBundle\Model\BlockInterface"/>

</document>

</doctrine-mapping>
1 change: 1 addition & 0 deletions src/Resources/config/doctrine-phpcr/MenuBlock.phpcr.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
name="Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\MenuBlock"
referenceable="true"
property="blockMenu"
is-leaf="true"
>

<reference-one name="menuNode"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<document
name="Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\ReferenceBlock"
referenceable="true"
is-leaf="true"
>

<reference-one name="referencedBlock"/>
Expand Down
1 change: 1 addition & 0 deletions src/Resources/config/doctrine-phpcr/RssBlock.phpcr.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<document
name="Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\RssBlock"
referenceable="true"
is-leaf="true"
>
</document>

Expand Down
1 change: 1 addition & 0 deletions src/Resources/config/doctrine-phpcr/SimpleBlock.phpcr.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
name="Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\SimpleBlock"
referenceable="true"
translator="attribute"
is-leaf="true"
>

<locale name="locale"/>
Expand Down
2 changes: 2 additions & 0 deletions src/Resources/config/doctrine-phpcr/SlideshowBlock.phpcr.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

<field name="title" type="string" translated="true" nullable="true"/>

<child-class name="Sonata\BlockBundle\Model\BlockInterface"/>

</document>

</doctrine-mapping>
1 change: 1 addition & 0 deletions src/Resources/config/doctrine-phpcr/StringBlock.phpcr.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
name="Symfony\Cmf\Bundle\BlockBundle\Doctrine\Phpcr\StringBlock"
referenceable="true"
translator="attribute"
is-leaf="true"
>

<locale name="locale"/>
Expand Down

0 comments on commit 6177f69

Please sign in to comment.