/**
  * @param  AbstractRelationMapping $fieldMapping
  * @param  string                  $relatedName
  * @param  string                  $methodPrefix
  * @param  string                  $relatedMethodPrefix
  * @param  string                  $collectionMethodName
  * @param  Arg                     $relatedArgument
  * @return Node
  */
 protected function getBidiretionalMethodNode(AbstractRelationMapping $fieldMapping, $relatedName, $methodPrefix, $relatedMethodPrefix, $collectionMethodName, $relatedArgument)
 {
     $name = $fieldMapping->getName();
     $singularName = StringUtil::singularify($name);
     $singularRelatedName = StringUtil::singularify($relatedName);
     $targetModel = $fieldMapping->getTargetModel();
     return new ClassMethod($methodPrefix . ucfirst($singularName), array('type' => 1, 'params' => array(new Param($singularName, null, new Name($targetModel)), new Param('stopPropagation', new ConstFetch(new Name('false')))), 'stmts' => array(new MethodCall(new PropertyFetch(new Variable('this'), $name), $collectionMethodName, array(new Arg(new Variable($singularName)))), new If_(new BooleanNot(new Variable('stopPropagation')), array('stmts' => array(new MethodCall(new Variable($singularName), $relatedMethodPrefix . ucfirst($singularRelatedName), array($relatedArgument, new Arg(new ConstFetch(new Name('true')))))))), new Return_(new Variable('this')))), array('comments' => array(new Comment(new Documentor(array(new ParamRow($targetModel, $singularName), new ParamRow('bool', 'stopPropagation'), new ReturnRow('$this')))))));
 }
 /**
  * @param  AbstractRelationMapping $fieldMapping
  * @return string
  */
 protected function getVarString(AbstractRelationMapping $fieldMapping)
 {
     return $fieldMapping->getTargetModel() . '[]|\\Doctrine\\Common\\Collections\\Collection';
 }
 /**
  * @param  AbstractRelationMapping $fieldMapping
  * @return string
  */
 protected function getVarString(AbstractRelationMapping $fieldMapping)
 {
     return $fieldMapping->getTargetModel();
 }