phalcon: 查找记录(Finding Records)可用的查询设置如下:

可用的查询设置如下:

参数描述举例
conditionsSearch conditions for the find operation. Is used to extract only those records that fulfill a specified criterion. By default Phalcon\Mvc\Model assumes the first parameter are the conditions.“conditions” => “name LIKE ‘steve%’”
columnsReturn specific columns instead of the full columns in the model. When using this option an incomplete object is returned“columns” => “id, name”
bindBind is used together with options, by replacing placeholders and escaping values thus increasing security“bind” => array(“status” => “A”, “type” => “some-time”)
bindTypesWhen binding parameters, you can use this parameter to define additional casting to the bound parameters increasing even more the security“bindTypes” => array(Column::BIND_TYPE_STR, Column::BIND_TYPE_INT)
orderIs used to sort the resultset. Use one or more fields separated by commas.“order” => “name DESC, status”
limitLimit the results of the query to results to certain range“limit” => 10 / “limit” => array(“number” => 10, “offset” => 5)
groupAllows to collect data across multiple records and group the results by one or more columns“group” => “name, status”
for_updateWith this option, Phalcon\Mvc\Model reads the latest available data, setting exclusive locks on each row it reads“for_update” => true
shared_lockWith this option, Phalcon\Mvc\Model reads the latest available data, setting shared locks on each row it reads“shared_lock” => true
cacheCache the resultset, reducing the continuous access to the relational system“cache” => array(“lifetime” => 3600, “key” => “my-find-key”)
hydrationSets the hydration strategy to represent each returned record in the result“hydration” => Resultset::HYDRATE_OBJECTS

If you prefer, there is also available a way to create queries in an object-oriented way, instead of using an array of parameters:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值