public function addValue($num, $user_id, $rights)
 {
     $val = new CollectionsRights();
     $val->Collections = $this->getObject();
     $val->setUserRef($user_id);
     $val->setDbUserType($rights);
     $form = new CollectionsRightsForm($val, array('user_id' => $user_id));
     $this->embeddedForms['newVal']->embedForm($num, $form);
     //Re-embedding the container
     $this->embedForm('newVal', $this->embeddedForms['newVal']);
 }
 public function configure()
 {
     $subForm = new sfForm();
     $collections = Doctrine::getTable('Collections')->fetchByCollectionParent($this->options['current_user'], $this->options['user_ref'], $this->options['collection_ref']);
     foreach ($collections as $record) {
         if (count($record->CollectionsRights)) {
             $right = $record->CollectionsRights[0];
         } else {
             $right = new CollectionsRights();
             $right->setCollectionRef($record->getId());
             $right->setDbUserType(0);
             $right->setUserRef($this->options['user_ref']);
         }
         $form = new SubCollectionsRightsForm($right, array('collection' => $record));
         $subForm->embedForm($record->getId(), $form);
     }
     $this->embedForm('collections', $subForm);
     $this->widgetSchema->setNameFormat('sub_collection[%s]');
 }