The problem is i get only 1 image from the database. What i want is to get all the images into a different array so i can view them per project.
IndexController.php
public function projectsAction() {
$projects = $this->getProjectsTable()->fetchAll();
return new ViewModel(array(
'projects' => $projects,
));
}
public function getProjectsTable() {
if (!$this->projectsTable) {
$sm = $this->getServiceLocator();
$this->projectsTable = $sm->get('Application\Model\ProjectsTable');
}
return $this->projectsTable;
}
ProjectsTable.php
public function fetchAll() {
$select = new Select();
$select->from('projects', array('projects.*'))
->join('project_images', 'projects.id=project_images.project_id', array('*'))
->where('projects.id=project_images.project_id');
//echo $select->getSqlString();
$resultSet = $this->selectWith($select);
$resultSet->buffer();
return $resultSet;
}
OUTPUT:
array(17) {
**PROJECTS STARTS FROM HERE**
["id"]=>
string(1) "1"
["name"]=>
string(55) "Name"
["country"]=>
string(6) "country"
["location_country"]=>
string(13) "location"
**PROJECT IMAGES STARTS FROM HERE**
["project_id"]=>
string(1) "1"
["image_name"]=>
string(29) "1_1370202251.808419328090.png"
["date"]=>
string(22) "2013-06-02 07:44:11 PM"
}