Phalcon框架之奇葩

今天用Phalcon出现一个奇葩现象:php

奇葩现象一:delete语句运行不了html

$sql = "delete from borrowrequest br where br.book_id = :book_id: and br.user_id = :user_id: limit 1";mysql

报此等错误:Unknown column 'borrowrequest.book_id' in 'field list' (奇怪,明明有这个字段,并且phalcon中,sql语句中的表必需要有别名)linux

若是去掉别名phalcon又会报错:sql

Column 'book_id' doesn't belong to any of the selected models数据库

可是,拿到数据库里单独运行该sql语句,发现也运行不了,mysql中 delete语句,不能够带表别名。去掉别名后运行正常。url

郁闷,试了很久,后来用全表名才运行通顺spa

$sql = "delete from borrowrequest where borrowrequest.book_id = :book_id: and borrowrequest.user_id = :user_id: limit 1";.net

 

 奇葩现象二:用devtools(1.3)自动生成modelunix

 phalcon model return_request  //结果生成是的ReturnRequest

$br = new BorrowRequest();
echo $br->getSource(); //输出的是borrow_request 至关因而个别名

奇葩现象三:对表名大小写极度敏感(mac、linux、win下)

上面现象二中,生成ReturnRequest.php的model类,则ReturnRequest类里面,全部的表名必需要大小写一致,都用ReturnRequest,而不是return_request

$requests = $obj_bookReq->getBorrowReqFromMe() //sql语句里面的表名也要注意

 

奇葩现象四:url的action大小写要与view页面的大小写一致,否则linux下报错,蛋疼

http://10.217.**.83:8085/index/borrowReqFromOther // view页面的名字也必须大小写一致,borrowReqFromOther.phtml ,我去!

 

 

 

相关连接:

http://phalcon.5iunix.net

相关文章
相关标签/搜索