如何检查学说陈述的结果 [英] how to check result of doctrine statement

查看:66
本文介绍了如何检查学说陈述的结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用此代码使用学说从数据库中删除数据

I use this code to remove data from database using doctrine

$user = $em->getReference('model\User', $id);
$em->remove($user);
$em->flush();

如何检查$ user是否被删除?

how I can check if the $user is deleted or not?

$em->flush();返回的数据是什么?

推荐答案

我已经使用trycatch()块来解决此问题 当尝试正确执行时,我返回了true,但是在捕获时我返回了False

i have used try and catch() blocks to solve this issue when try excute correctly i have return true and in catch i return False

这篇关于如何检查学说陈述的结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆