Entities/Roles/Model/RolesTableMapper.php
public function deleteByPrimaryKey($primaryKeyValue, ?string $returnField = null): ?string
    {
        // make sure role exists and is deletable
        if (null === $role = $this->getObjectById((int) $primaryKeyValue)) {
            throw new Exceptions\QueryResultsNotFoundException("Role not found: id $primaryKeyValue");
        }

        if (!$role->isDeletable((int) $primaryKeyValue)) {
            throw new Exceptions\UnallowedActionException("Role in use: id $primaryKeyValue");
        }

        return parent::deleteByPrimaryKey($primaryKeyValue, $returnField);
    }
public function deleteByPrimaryKey($primaryKeyValue, ?string $returnField = null): ?string
    {
        // make sure role exists and is deletable
        if (null === $role = $this->getObjectById((int) $primaryKeyValue)) {
            throw new Exceptions\QueryResultsNotFoundException("Role not found: id $primaryKeyValue");
        }

        if (!$role->isDeletable((int) $primaryKeyValue)) {
            throw new Exceptions\UnallowedActionException("Role in use: id $primaryKeyValue");
        }

        return parent::deleteByPrimaryKey($primaryKeyValue, $returnField);
    }
override for validation