Permalink
Browse files

adapted containerblock so new items can be added with sonata

  • Loading branch information...
1 parent 7a38394 commit dbbdbde6397630b3f77a98cbc3e0fa38db015d95 @elHornair elHornair committed Feb 22, 2013
Showing with 12 additions and 8 deletions.
  1. +12 −8 Document/ContainerBlock.php
@@ -14,7 +14,10 @@
*/
class ContainerBlock extends BaseBlock
{
- /** @PHPCRODM\Children */
+ /**
+ * \Doctrine\Common\Collections\ArrayCollection
+ * @PHPCRODM\Children
+ */
protected $children;
public function __construct($name = null)
@@ -45,18 +48,18 @@ public function setChildren(ChildrenCollection $children)
* Add a child to this container
*
* @param BlockInterface $child
- * @param string $key OPTIONAL
* @return boolean
*/
- public function addChild(BlockInterface $child, $key = null)
+ public function addChild(BlockInterface $child)
{
- if ($key != null) {
- return $this->children->set($key, $child);
- }
-
return $this->children->add($child);
}
+ public function addChildren(BlockInterface $children)
+ {
+ return $this->addChild($children);
+ }
+
/**
* Remove a child from this container
*
@@ -65,6 +68,7 @@ public function addChild(BlockInterface $child, $key = null)
*/
public function removeChild($child)
{
- $this->children->remove($child->getId());
+ $this->children->removeElement($child);
}
+
}

0 comments on commit dbbdbde

Please sign in to comment.