Home > Article > Backend Development > When querying data with phalcon orm, if the field does not exist, will the condition be ignored?
phalcon+mongo, mongo's fields are automatically created when adding data, so when querying, non-existent fields may be used as query conditions. But at this time, phalcon orm will ignore the conditions and return irrelevant Other record lines. How to solve this problem better?
<code>$memberVercode = \Model\MemberVercode::findFirst(array( array('telphone' => $telphone), )); if ($memberVercode/*这个变量怎么判断比较好,即使telphone字段不存在,他依然返回一个纪录对象*/) { //如果存在,则更新操作 } else { //添加操作 }</code>
phalcon+mongo, mongo's fields are automatically created when adding data, so when querying, non-existent fields may be used as query conditions. But at this time, phalcon orm will ignore the conditions and return irrelevant Other record lines. What is the best way to solve this problem?
<code>$memberVercode = \Model\MemberVercode::findFirst(array( array('telphone' => $telphone), )); if ($memberVercode/*这个变量怎么判断比较好,即使telphone字段不存在,他依然返回一个纪录对象*/) { //如果存在,则更新操作 } else { //添加操作 }</code>