Home > Backend Development > PHP Tutorial > When querying data with phalcon orm, if the field does not exist, will the condition be ignored?

When querying data with phalcon orm, if the field does not exist, will the condition be ignored?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-08-04 09:22:11
Original
1442 people have browsed it

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>
Copy after login
Copy after login

Reply content:

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>
Copy after login
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template