plugin/competency/Manager/CompetencyManager.php
public function associateAbilityToResources(Ability $ability, array $nodes)
    {
        $associatedNodes = [];

        foreach ($nodes as $node) {
            if (!$ability->isLinkedToResource($node)) {
                $ability->linkResource($node);
                $associatedNodes[] = $node;
            }
        }
        $this->om->persist($ability);
        $this->om->flush();

        return $associatedNodes;
    }
public function associateAbilityToResources(Ability $ability, array $nodes)
    {
        $associatedNodes = [];

        foreach ($nodes as $node) {
            if (!$ability->isLinkedToResource($node)) {
                $ability->linkResource($node);
                $associatedNodes[] = $node;
            }
        }
        $this->om->persist($ability);
        $this->om->flush();

        return $associatedNodes;
    }
public function associateAbilityToResources ( Ability $ ability , array $ nodes ) { $ associatedNodes = [ ] ; foreach ( $ nodes as $ node ) { if ( ! $ ability -> isLinkedToResource ( $ node ) ) { $ ability -> linkResource ( $ node ) ; $ associatedNodes [ ] = $ node ; } } $ this -> om -> persist ( $ ability ) ; $ this -> om -> flush ( ) ; return $ associatedNodes ; }
Associates an ability to several resource nodes.

@param Ability $ability
@param array   $nodes

@return string
Associates an ability to several resource nodes .