Bonjour,
je rencontre un pb que je n'arrive décidément pas à résoudre.
J'ai 2 tables : artistes et songs. Les relations sont assez évidentes, les artistes sont parents des chansons.
ma classe artistes :
ma classe songs
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 class Artistes extends Zend_Db_Table_Abstract { /* Nom de la table */ protected $_name = 'artistes'; /* Clé primaire */ protected $_primary = 'id'; /* Nom des table enfants */ protected $_dependentTables = array('Songs');
J'ai un objet artiste, d'où j'appelle la méthode findDependentRowset, afin d'avoir les chansons affiliées.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 class Songs extends Zend_Db_Table_Abstract { protected $_name = 'chansons'; protected $_primary = 'id'; protected $_referenceMap = array( 'Interprete' => array( 'columns' => 'id_artiste', 'refTableClass' => 'Artistes', 'refColumns' => 'id' ) );
Et là j'ai l'erreur :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 $table = new Artistes(); $artistrowset = $table->find('5'); // pour exemple $artist = $artistrowset->current(); // $artist contient l'objet zend..._row. return $artist->findDependentRowset('Songs');
Pourtant mon fichier existe bien, il se situe dans /application/models/DbTable/, le nom de la classe est bon.Zend_Db_Table_Row_Exception: File "Songs.php" does not exist or class "Songs" was not found in the file
#0 C:\wamp\www\coverchords\application\models\Artistes.php(57): Zend_Db_Table_Row_Abstract->findDependentRowset('Songs')
#1 C:\wamp\www\coverchords\application\controllers\ArtistController.php(53): Model_Artistes->listSongs('5')
#2 C:\wamp\www\coverchords\library\Zend\Controller\Action.php(503): ArtistController->songslistAction()
#3 C:\wamp\www\coverchords\library\Zend\Controller\Dispatcher\Standard.php(285): Zend_Controller_Action->dispatch('songslistAction')
#4 C:\wamp\www\coverchords\library\Zend\Controller\Front.php(934): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#5 C:\wamp\www\coverchords\public\index.php(44): Zend_Controller_Front->dispatch()
#6 {main}
Tiens juste pour me marrer, j'ai copié Songs.php un peu partout dans l'arbo... et dans public ça marche !
Y a quelquechose à changer concernant la convention d'arborescence ?
Merci pour votre aide.
Partager