我正在使用 Symfony 和 Doctrine。
我定义了两个类,Person 和Student,一对一的关系。
每个Student 都与Person 相关,但并非每个Person 都与Student 相关。
当我调用...
$person->getStudent();
...我总是得到并反对,不管某些Person 没有学生。我怎么知道它(Student)不存在于数据库中?
谢谢。
最佳答案
关于php - 如何知道数据库中是否存在关系中的对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2098140/