im not pretty sure if the title is correct, but here i go:
$this->screenshots = $Screenshot->find('all');
i want to change this:
$this->screenshots[0]->id
$this->screenshots[0]->name
$this->screenshots[0]->lastname
to this:
$this->screenshots[id]->name
$this->screenshots[id]->lastname
a built-in akelos solution to this?
Hi Insanet,
What do you want to do exactly ? Because, if you are trying to change the properties of each screenshot, you can do it using
foreach ($this->screenshots as $screenshot) {
$screenshot->setAttribute('name',$variable);
$screenshot->setAttribute('lastname',$variable);
}
You have the collect method to generate id => field arrays from ActiveRecord result sets like:
$this->Screenshots = $Screenshot->collect($Screenshot->find(), 'id', 'name');
If you need to hold the id on the keys of result sets a simple foreach will help you with that as Akelos has nothing built in for that.
1 to 3 of 3