Welcome Guest, Not a member yet? Register   Sign In
Query Builder Class - Problem with delete vs foreign key constraint

Hi everyone!

I have this code:
PHP Code:
     * TODO - Deleta uma permissão do banco de dados
     * @param Int $id
     * @return Bool
public static function deletePermission(Int $id): Bool
//define a tabela
$builder $_ENV['db']->table(parent::$tabPermissoes);

//tenta deletar o item
if($builder->delete(['id' => $id]) !== false) return true;
        else return 

The code is working when delete function returns !== false ... and seeing the docs https://codeigniter.com/user_guide/datab...ete#delete , in case of failure, the delete function would return false. But I'm getting an error, because I have a MySQL foreign key constraint.

I can fix it checking this foreign key constraint first, but the delete function would not returning false?

Theme © iAndrew 2016 - Forum software by © MyBB