开发者

additionals properties of a model in cakephp?

开发者 https://www.devze.com 2023-04-01 03:27 出处:网络
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?

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

精彩评论

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

关注公众号