Problème Zend Framework Fatal error: Class 'Application_Model_

Résolu/Fermé
Sébastien - 18 nov. 2013 à 15:37
 Sébastien - 18 nov. 2013 à 15:53
Bonjour,


mon code ne marche pas, aidez moi s'il vous plait.

Voici mon code :

IndexController.php

<?php

class IndexController extends Zend_Controller_Action
{

public function init()
{
/* Initialize action controller here */
}

public function indexAction()
{
$albums = new Application_Model_DbTable_Albums();
$this->view->albums = $albums->fetchAll();
}

public function ajouterAction()
{
// action body
}

public function modifierAction()
{
// action body
}

public function supprimerAction()
{
// action body
}


}




index.phtml

<?php
$this->title = 'Mes Albums';
$this->headTitle($this->title);
?>
<p><a href="<?php echo $this->url(array('controller'=>'index',
'action'=>'ajouter'));?>">Ajouter de nouveaux albums</a></p>
<table>
<tr>
<th>Titre</th>
<th>Artiste</th>
<th> </th>
</tr>
<?php foreach($this->albums as $album) : ?>
<tr>
<td><?php echo $this->escape($album->titre);?></td>
<td><?php echo $this->escape($album->artiste);?></td>
<td>
<a href="<?php echo $this->url(array('controller'=>'index',
'action'=>'modifier', 'id'=>$album->id));?>">Modifier</a>
<a href="<?php echo $this->url(array('controller'=>'index',
'action'=>'supprimer', 'id'=>$album->id));?>">Supprimer</a>
</td>
</tr>
<?php endforeach; ?>
</table>


Album.php

<?php

class Application_Model_DbTable_Albums extends Zend_Db_Table_Abstract
{
protected $_name = 'albums';

public function obtenirAlbum($id)
{
$id = (int)$id;
$row = $this->fetchRow('id = ' . $id);
if (!$row) {
throw new Exception("Impossible de trouver l'enregistrement $id");
}
return $row->toArray();
}

public function ajouterAlbum($artiste, $titre)
{
$data = array(
'artiste' => $artiste,
'titre' => $titre,
);
$this->insert($data);
}

public function modifierAlbum($id, $artiste, $titre)
{
$data = array(
'artiste' => $artiste,
'titre' => $titre,
);
$this->update($data, 'id = '. (int)$id);
}

public function supprimerAlbum($id)
{
$this->delete('id =' . (int)$id);
}
}




application.ini

[production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0
phpSettings.date.timezone = "Europe/Paris"
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"

resources.db.adapter = PDO_MYSQL
resources.db.params.host = localhost
resources.db.params.username = root
resources.db.params.password =
resources.db.params.dbname = znd

resources.view.doctype = "XHTML1_STRICT"

[staging : production]

[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1

[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1






Je suis débutant, merci d'avance, le version de mon Zend est : 1.10
A voir également:

1 réponse

Merci j'ai résolu, a la place de Album.php il faut mettre Albums.php. Merci
0