Not signed in (Sign In)
Welcome Guest!
Want to take part in these discussions? If you have an account, sign in now.
If you don't have an account, apply for one now.
    • CommentAuthorinsanet
    • CommentTimeJun 25th 2008
     

    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?

    •  
      CommentAuthorfrancois
    • CommentTimeJun 25th 2008
     

    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);
            }
    
    •  
      CommentAuthorbermi
    • CommentTimeJun 26th 2008
     

    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.

Add your comments
    Username Password
  • Format comments as