Question

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

Was it helpful?

Solution

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;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top