Esempio n. 1
0
 /**
  * @param TblGroup $tblGroup
  *
  * @return bool
  */
 public function destroyGroup(TblGroup $tblGroup)
 {
     $Manager = $this->Connection->getEntityManager();
     /** @var TblMember $Entity */
     $Entity = $Manager->getEntityById('TblGroup', $tblGroup->getId());
     if (null !== $Entity) {
         Protocol::useService()->createDeleteEntry($this->Connection->getDatabase(), $Entity);
         $Manager->killEntity($Entity);
         return true;
     }
     return false;
 }
Esempio n. 2
0
 /**
  * @param null|TblGroup $tblGroup
  */
 public function setTblGroup(TblGroup $tblGroup = null)
 {
     $this->tblGroup = null === $tblGroup ? null : $tblGroup->getId();
 }
Esempio n. 3
0
 /**
  * @param IFormInterface $Form
  * @param TblGroup       $tblGroup
  * @param array          $Group
  *
  * @return IFormInterface|Redirect
  */
 public function updateGroup(IFormInterface $Form = null, TblGroup $tblGroup, $Group)
 {
     /**
      * Skip to Frontend
      */
     if (null === $Group) {
         return $Form;
     }
     $Error = false;
     if (isset($Group['Name']) && empty($Group['Name'])) {
         $Form->setError('Group[Name]', 'Bitte geben Sie einen Namen für die Gruppe an');
         $Error = true;
     } else {
         $tblGroupTwin = $this->getGroupByName($Group['Name']);
         if ($tblGroupTwin && $tblGroupTwin->getId() != $tblGroup->getId()) {
             $Form->setError('Group[Name]', 'Bitte geben Sie einen eineindeutigen Namen für die Gruppe an');
             $Error = true;
         }
     }
     if (!$Error) {
         if ((new Data($this->Binding))->updateGroup($tblGroup, $Group['Name'], $Group['Description'], $Group['Remark'])) {
             return new Success('Die Änderungen wurden erfolgreich gespeichert') . new Redirect('/Corporation/Group', 1);
         } else {
             return new Danger('Die Änderungen konnte nicht gespeichert werden') . new Redirect('/Corporation/Group', 10);
         }
     }
     return $Form;
 }