Entities/Administrators/Model/AdministratorsEntityMapper.php
public function delete(int $id, AuthenticationService $authentication, AuthorizationService $authorization): string
    {
        // make sure there is an administrator for the primary key
        if (null === $administrator = $this->getObjectById($id)) {
            throw new Exceptions\QueryResultsNotFoundException();
        }

        $administrator->setAuth($authentication, $authorization);

        if (!$administrator->isDeletable()) {
            throw new Exceptions\UnallowedActionException($administrator->getNotDeletableReason());
        }

        $this->doDeleteTransaction($id);

        $username = $administrator->getUsername();
        unset($administrator);

        return $username;
    }
public function delete(int $id, AuthenticationService $authentication, AuthorizationService $authorization): string
    {
        // make sure there is an administrator for the primary key
        if (null === $administrator = $this->getObjectById($id)) {
            throw new Exceptions\QueryResultsNotFoundException();
        }

        $administrator->setAuth($authentication, $authorization);

        if (!$administrator->isDeletable()) {
            throw new Exceptions\UnallowedActionException($administrator->getNotDeletableReason());
        }

        $this->doDeleteTransaction($id);

        $username = $administrator->getUsername();
        unset($administrator);

        return $username;
    }
public function delete ( int $ id , AuthenticationService $ authentication , AuthorizationService $ authorization ) : string { // make sure there is an administrator for the primary key if ( null === $ administrator = $ this -> getObjectById ( $ id ) ) { throw new Exceptions \ QueryResultsNotFoundException ( ) ; } $ administrator -> setAuth ( $ authentication , $ authorization ) ; if ( ! $ administrator -> isDeletable ( ) ) { throw new Exceptions \ UnallowedActionException ( $ administrator -> getNotDeletableReason ( ) ) ; } $ this -> doDeleteTransaction ( $ id ) ; $ username = $ administrator -> getUsername ( ) ; unset ( $ administrator ) ; return $ username ; }
does validation for delete then deletes and returns deleted username
does validation for delete then deletes and returns deleted username