Пример #1
0
 /**
  * @param Group $group
  */
 public function removeGroup(Group $group)
 {
     if (!$this->groups->contains($group)) {
         return;
     }
     $this->groups->removeElement($group);
     $group->removeUser($this);
 }
Пример #2
0
 /**
  * Add new settings meta info.
  *
  * @param Meta $meta
  */
 public function addMeta(Meta $meta)
 {
     $group = $meta->getGroup();
     if (!$this->groups->has($group)) {
         $this->groups->put($group, new Collection());
     }
     if ($this->all->has($meta->getName())) {
         throw new \RuntimeException('Settings with name `' . $meta->getName() . '` already exists .');
     }
     $this->all->put($meta->getName(), $meta);
     //$this->groups->get($group);
     $this->groups->get($group)->put($meta->getName(), $meta);
 }
Пример #3
0
 /**
  * Add another Menu instance and combined the two
  * Groups with the same name get combined, but
  * inherit each other's items
  *
  * @param Menu $menu
  *
  * @return Menu $menu
  */
 public function add(Menu $menu)
 {
     foreach ($menu->getGroups() as $group) {
         if ($this->groups->has($group->getName())) {
             $existingGroup = $this->groups->get($group->getName());
             $group->hideHeading(!$group->shouldShowHeading());
             foreach ($group->getItems() as $item) {
                 $existingGroup->addItem($item);
             }
         } else {
             $this->addGroup($group);
         }
     }
     return $this;
 }
Пример #4
0
 public function hasGroup(Group $group)
 {
     return $this->groups->contains($group);
 }
Пример #5
0
 /**
  * Remove group
  *
  * @param Group $group
  *
  * @return $this
  */
 public function removeGroups(Group $group)
 {
     $this->groups->remove($group);
     return $this;
 }
Пример #6
0
 public function jsonSerialize()
 {
     return ['id' => $this->id, 'username' => $this->username, 'firstName' => $this->firstName, 'lastName' => $this->lastName, 'email' => $this->email, 'createdDate' => $this->createdDate, 'editedDate' => $this->editedDate, 'createdBy' => $this->createdBy, 'editedBy' => $this->editedBy, 'groups' => $this->groups->toArray()];
 }
Пример #7
0
 /**
  * Remove groups
  *
  * @param \Group $group
  */
 public function removeGroup(\Group $group)
 {
     $this->groups->removeElement($group);
 }
 /**
  * Remove a group
  *
  * @param Group $group
  *
  * @return AbstractAssociation
  */
 public function removeGroup(Group $group)
 {
     $this->groups->removeElement($group);
     return $this;
 }
Пример #9
0
 /**
  * Remove groups
  *
  * @param \Group $groups
  */
 public function removeGroup(\Group $groups)
 {
     /** @noinspection PhpUndefinedMethodInspection */
     $this->groups->removeElement($groups);
 }