Phalcon ORM Query data, the field does not exist, ignore the condition?

Source: Internet
Author: User
Phalcon+mongo, MONGO fields are created automatically when the data is added, so queries may use fields that do not exist as query criteria. But at this point the Phalcon ORM ignores the condition and returns unrelated rows of records. How to solve this problem better?

$memberVercode = \Model\MemberVercode::findFirst(array(    array('telphone'    =>  $telphone),));if ($memberVercode/*这个变量怎么判断比较好,即使telphone字段不存在,他依然返回一个纪录对象*/) {    //如果存在,则更新操作} else {    //添加操作}

Reply content:

Phalcon+mongo, MONGO fields are created automatically when the data is added, so queries may use fields that do not exist as query criteria. But at this point the Phalcon ORM ignores the condition and returns unrelated rows of records. How to solve this problem better?

$memberVercode = \Model\MemberVercode::findFirst(array(    array('telphone'    =>  $telphone),));if ($memberVercode/*这个变量怎么判断比较好,即使telphone字段不存在,他依然返回一个纪录对象*/) {    //如果存在,则更新操作} else {    //添加操作}
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.