get('attachments'); $ids = array(); $names = new \stdClass(); $types = new \stdClass(); foreach ($collection as $e) { $id = $e->id; $ids[] = $id; $names->$id = $e->get('name'); $types->$id = $e->get('type'); } $this->set('attachmentsIds', $ids); $this->set('attachmentsNames', $names); $this->set('attachmentsTypes', $types); } }