/** * @param Group $group */ public function removeGroup(Group $group) { if (!$this->groups->contains($group)) { return; } $this->groups->removeElement($group); $group->removeUser($this); }
/** * 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); }
/** * 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; }
public function hasGroup(Group $group) { return $this->groups->contains($group); }
/** * Remove group * * @param Group $group * * @return $this */ public function removeGroups(Group $group) { $this->groups->remove($group); return $this; }
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()]; }
/** * 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; }
/** * Remove groups * * @param \Group $groups */ public function removeGroup(\Group $groups) { /** @noinspection PhpUndefinedMethodInspection */ $this->groups->removeElement($groups); }