0
votes

I would like to know how the scope_column works using Propel nested set in symfony.

I'd like to save each item from a form using nested set. here some code:

the submenu model has this attributes: id, parent_id,url, menu_user_atribute_id

//SubMenu.php

public function doSave(PropelPDO $con)
{
  if($this->getParentId() == null)
  {
    $this->makeRoot();
  }else{
    $parent = SubMenuPeer::retrieveByPK($this->getParentId());
    $this->setParent($parent);
    $this->getParent()->addChild($this);
  }
  parent::doSave($con);
}

but when I want to save another item with a diferente scope value (in this case scope_column = menu_user_role_id), this is replaced by the first scopeValue.

the submenu item 19 with menu_user_role=28, but it should be 29.

id  parent_id  menu_user_role_id  Detail_url_id   TreeLeft  treeRight  treeLevel
17  NULL      28                  1               1         2          0
18  17        28                  2               2         3          1
19  17        28                  3               2         3          1
1

1 Answers

2
votes

You need to enable the use of a scope before you can define what the scope_id is:

<behavior name="nested_set">
  <parameter name="use_scope" value="true" />
  <parameter name="scope_column" value="menu_user_role_id" />
</behavior>