开发者

additionals properties of a model in cakephp?

I'm starting to use cakePhp and I would like to know:

When I do a query(like with $this->Product->find(...)), I receive an array, right?

Then: -If I've some non-db fields with default values that I've to display for each 开发者_运维百科product, how do I do?

I saw virtual fields, but I cannot manage to put a static var into it


You can use the solution Anh Pham provided another thing you could do, if it's just setting the values to display them, is add them to the array in your controller after you have the results:

$result['Model']['desired_field_name'] = $static_field;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜