带有数组绑定的Doctrine 1.2查询

时间:2017-07-10 06:27:40

标签: php symfony doctrine doctrine-1.2 orange

我有这段代码:

Select * from attendanceRecord a where employeeId IN ('2,4,5')

$ employeeId是一个数字数组

sql输出是:

Select * from attendanceRecord a where employeeId IN (2,4,5)

但它有引用而且错了我想要这个:

y = x[:,:2]

我如何在学说中正确地做到这一点?

1 个答案:

答案 0 :(得分:2)

简单如下:

$(function checkForBlank() {
  $("#username_err_msg").hide();
  $("#email_err_msg").hide();
  $("#pwd_err_msg").hide();
  $("#confirm_pwd_err_msg").hide();
  $("#fname_err_msg").hide();
  $("#lname_err_msg").hide();


  var username_err = false;
  var email_err = false;
  var pwd_err_msg = false;
  var confirm_pwd_err_msg = false;
  var fname_err = false;
  var lname_err = false;


  $("#userName").focusout(function() {
    check_userName();
  });
  $("#inputEmail").focusout(function() {
    check_email();

  });
  $("#password").focusout(function() {
    check_pwd();
  });
  $("#inputConfirmPassword").focusout(function() {
    check_pwd_conf();
  });
  $("#inputFirstName").focusout(function() {
    check_fname();
  });
  $("#inputLastName").focusout(function() {
    check_lname();
  });


  function check_userName() {
    var username_length = $("#userName").val().length;
    if (username_length < 5 || username_length > 20) {
      $("#username_err_msg").html("Username must be between 5 and 20 characters ! ");
      $("#username_err_msg").show();
      username_err = true;
    } else {
      $("#username_err_msg").hide();
    }
  }

  function check_pwd() {

    var pass = $("#password").val();
    var pass_length = $("#password").val().length;
    var re = /^[a-zA-Z_0-9@\!#\$\^%&*()+=\-[]\\\';,\.\/\{\}\|\":<>\? ]+$/;
    //if pwd is less than 10 and doesnt contain special chars
    if (pass_length < 6) {
      $("#pwd_err_msg").html("Weak ! ");
      $("#pwd_err_msg").show();
      pwd_err_msg = true;
    } else {
      //if pwd is >= 5 or <= 10,and contains special char
      if (pass_length >= 6 && pass_length < 9 && !re.test(pass)) {
        $("#pwd_err_msg").html("Medium! ");
        $("#pwd_err_msg").show();
        pwd_err_msg = true;
      } else {
        //if pwd >11 and contains special char
        if (pass_length >= 9 && !re.test(pass)) {
          $("#pwd_err_msg").html("Strong! ");
          $("#pwd_err_msg").show();
          pwd_err_msg = true;
        } else {
          $("#pwd_err_msg").hide();
        }
      }
    }
  }

  function check_pwd_conf() {
    var pass1 = $("#password").val();
    var pass2 = $("#inputConfirmPassword").val();
    if (pass1 != pass2) {
      $("#confirm_pwd_err_msg").html("Passwords don't match! ");
      $("#confirm_pwd_err_msg").show();
      pwd_err_msg = true;
    } else {
      $("#confirm_pwd_err_msg").hide();
    }
  }

  function check_email() {
    var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
    var email = $("#inputEmail").val();
    if (re.test(email)) //valid email address
    {
      $("#email_err_msg").hide();
    } else {
      $("#email_err_msg").html("Invalid email address!");
      $("#email_err_msg").show();
      email_err = true;
    }
  }

  function check_fname() {
    var fname_length = $("#inputFirstName").val().length;
    var first = $("#inputFirstName").val();
    var re = /\d/g;
    if (fname_length <= 2 || fname_length > 20) {
      $("#fname_err_msg").html("First name must be between 2 and 20 characters ! ");
      $("#fname_err_msg").show();
      fname_err = true;
    } else {
      if (re.test(first)) {
        $("#fname_err_msg").html("First name must not contain digits ! ");
        $("#fname_err_msg").show();
        fname_err = true;
      } else {
        $("#fname_err_msg").hide();
      }
    }
  }

  function check_lname() {
    var lname_length = $("#inputLastName").val().length;
    var sec = $("#inputLastName").val();
    var re = /\d/g;
    if (lname_length <= 2 || lname_length > 20) {
      $("#lname_err_msg").html("Last name must be between 2 and 20 characters ! ");
      $("#lname_err_msg").show();
      lname_err = true;
    } else {
      if (re.test(sec)) {
        $("#lname_err_msg").html("Last name must not contain digits ! ");
        $("#lname_err_msg").show();
        lname_err = true;
      } else {
        $("#lname_err_msg").hide();
      }
    }
  }

});

在提出问题之前,请确保您看到official documentation