Beispiel #1
0
 private function roleParentsCollSetup(Role $r)
 {
     if ($r === null) {
         throw new Exceptions\NullPointerException("Argument Role cannot be null");
     }
     $parents = $r->getParents();
     $parentsCollection = new ArrayCollection();
     if (is_array($parents) && count($parents) > 0) {
         foreach ($parents as $parentId) {
             $parentObject = $this->roleDao->find($parentId);
             $parentsCollection->add($parentObject);
         }
     }
     return $parentsCollection;
 }
Beispiel #2
0
 /**
  * Grid column parents render callback
  * @param \App\Model\Entities\Role $item
  * @return string of parents roles
  */
 public function roleParColToString(Role $item)
 {
     $res = "";
     $it = $item->getParents()->getIterator();
     while ($it->current() !== null) {
         $res .= $it->current()->getName();
         $it->next();
         if ($it->valid()) {
             $res .= ", ";
         }
     }
     return $res;
 }