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 [font=SFMono-Regular, Menlo, Monaco, Consolas,]delete function returns !== false[/font] ... and seeing the docs https://codeigniter.com/user_guide/datab...ete#delete , in case of failure, the delete [font=Tahoma, Verdana, Arial, sans-serif]function would return false. But I'm getting an error, because I have a MySQL foreign key constraint.[/font]

I can fix it checking this foreign key constraint first, but [font=Tahoma, Verdana, Arial, sans-serif]the [font=SFMono-Regular, Menlo, Monaco, Consolas,]delete [font=Tahoma, Verdana, Arial, sans-serif]function would not returning false?[/font][/font][/font]

Theme © iAndrew 2016 - Forum software by © MyBB