Précédent   Forum des professionnels en informatique > PHP > Outils > Zend > Zend Framework
Zend Framework Forum d'entraide sur la programmation PHP avec Zend Framework. Avant de poster -> FAQ ZF, Cours ZF
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 02/05/2011, 15h59   #1
Invité de passage
 
Homme
Développeur Web
Inscription : mai 2011
Messages : 27
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France

Informations professionnelles :
Activité : Développeur Web
Secteur : Administration - Collectivité locale

Informations forums :
Inscription : mai 2011
Messages : 27
Points : 0
Points : 0
Par défaut Fatal error : class not found

Bonjour, débutant sous Zend, j'ai encore quelques souci pour récupérer et afficher mes données de ma base SQL.

Voici l'erreur qu'il m'affiche à l'écran :

Fatal error: Class 'Model_DbTable_VueIncident' not found in C:\wamp\www\Zend1.11.5\application\controllers\VueIncidentController.php on line 13

Voici mon index.php :

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
 
<?php
 
// Define path to application directory
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '\..\application'));
 
echo dirname(dirname(__FILE__) . '\..\application');
// Define application environment
defined('APPLICATION_ENV')
    || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
 
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
    realpath(APPLICATION_PATH . '/../library'),
    realpath(APPLICATION_PATH . '/models'),
    get_include_path(),
)));
 
/** Zend_Application **/
require_once 'Zend/Application.php';
 
// Create application, bootstrap, and run
$application = new Zend_Application(
    APPLICATION_ENV,
    APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap()
            ->run();
Voici mon application.ini :

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
 
[production]
phpSettings.date.timezone = "Europe/Paris"
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
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
resources.view.doctype = "XHTML1_STRICT"
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
 
[connexion]
resources.db.adapter = sqlsrv
resources.db.params.host = PCISINSTDEV\SQLEXPRESS
resources.db.params.username = nom
resources.db.params.password = motdepasse
resources.db.params.dbname = nomdelabase
resources.db.isDefaultTableAdapter = true
 
 
[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
Mon controller :

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
 
<?php
 
class VueIncidentController extends Zend_Controller_Action
{
 
    public function init()
    {
        /* Initialize action controller here */
    }
 
    function indexAction()
    {
    	    $oIncident = new Model_DbTable_VueIncident();
    	    $this->view->VUE_INCIDENT = $oIncident->fetchAll();
    }
 
}
Mon model :

Code :
1
2
3
4
5
6
7
8
 
<?php
 
class Model_DbTable_VueIncident extends Zend_Db_Table_Abstract
{
    protected $_name = '[dbo].[VUE_INCIDENT]';
    protected $_primary = '[CLE_INCIDENT]';
}
Et ma vue :

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
 
<table>
<tr>
	<th>Numéro incident</th>
	<th>Descriptif</th>
</tr>
 
<?php foreach($this->VUE_INCIDENT as $incident) : ?>
<tr>
	<td><?php echo $incident->NO_INCIDENT;?></td>
	<td><?php echo $incident->DESCRIPTIF;?></td>
 
</tr>
<?php endforeach; ?>
</table>
Désoler, pour tous ce code mais est-ce quelqu'un à un avis sur l'erreur affiché ???

Merci d'avance

PS : J'utilise Zend 1.11.5 avec WampServer 2.0i et SQL Server 2008
1-Dicible est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 02/05/2011, 16h08   #2
Modérateur
 
Inscription : septembre 2010
Messages : 7 103
Détails du profil
Informations forums :
Inscription : septembre 2010
Messages : 7 103
Points : 8 466
Points : 8 466
pour créer un projet Zend c'est avec Zend_Application/Zend_Tool
le code que tu as est obsolète

http://framework.zend.com/manual/en/...art.intro.html

ou alors prend la même version que ton tutoriel/exemple
__________________
http://blog.stealth35.com/
stealth35 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/05/2011, 09h35   #3
Invité de passage
 
Homme
Développeur Web
Inscription : mai 2011
Messages : 27
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France

Informations professionnelles :
Activité : Développeur Web
Secteur : Administration - Collectivité locale

Informations forums :
Inscription : mai 2011
Messages : 27
Points : 0
Points : 0
Bonjour, j'ai été voir votre lien mais je suis sur windows xp alors que l'exemple est montré sur linux. Avez-vous un tutoriel avec sql server sur windows à me proposer ??

Merci d'avance
1-Dicible est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/05/2011, 10h46   #4
Modérateur
 
Inscription : septembre 2010
Messages : 7 103
Détails du profil
Informations forums :
Inscription : septembre 2010
Messages : 7 103
Points : 8 466
Points : 8 466
Citation:
Envoyé par 1-Dicible Voir le message
Bonjour, j'ai été voir votre lien mais je suis sur windows xp alors que l'exemple est montré sur linux. Avez-vous un tutoriel avec sql server sur windows à me proposer ??

Merci d'avance
non l'exemple est pour tout systèmes

Citation:
Open a terminal (in Windows, Start -> Run, and then use cmd)
__________________
http://blog.stealth35.com/
stealth35 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/05/2011, 14h28   #5
Invité de passage
 
Homme
Développeur Web
Inscription : mai 2011
Messages : 27
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France

Informations professionnelles :
Activité : Développeur Web
Secteur : Administration - Collectivité locale

Informations forums :
Inscription : mai 2011
Messages : 27
Points : 0
Points : 0
Ah oui pardis j'avais pas vu... j'ai suivi le tuto jusqu'à la partie pour la création de la table guestbook ( vu que j'utilise une bdd existante ) et je n'est plus aucune erreur mais toujours rien à l'affichage ... je ne comprends toujours pas ce qui cloche.

Je remets mon Bootstrap :

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
 
	protected function _initAutoload(){
		$autoloader = Zend_Loader_Autoloader::getInstance();
		$autoloader->setFallbackAutoloader(true);
		return $autoloader;
	}
 
protected function _initDb(){
		$log = $this->getResource('log');
    $config = new Zend_Config($this->getOptions());
    try{
    	$db = Zend_Db::factory($config->resources->db);
      $db->getConnection();
    }catch (Exception $e) {
    	$log->emerg($e->getMessage());
    	exit($e->getMessage());
    }
		Zend_Db_Table_Abstract::setDefaultAdapter ($db);
    return $db;
	}
Et l'application.ini :

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 
[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
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
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
resources.view[] =
 
resources.db.adapter = "sqlsrv"
resources.db.params.host = "PCISINSTDEV\SQLEXPRESS"
resources.db.params.username = "sa"
resources.db.params.password = "Change1234"
resources.db.params.dbname = "EVO_DATA50004"
 
resources.locale.default = "fr_FR"
[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
Une idée ??
Merci d'avance
1-Dicible est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/05/2011, 14h40   #6
Modérateur
 
Inscription : septembre 2010
Messages : 7 103
Détails du profil
Informations forums :
Inscription : septembre 2010
Messages : 7 103
Points : 8 466
Points : 8 466
t’accèdes à quelle adresse sur ton navigateur ?
__________________
http://blog.stealth35.com/
stealth35 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/05/2011, 15h02   #7
Invité de passage
 
Homme
Développeur Web
Inscription : mai 2011
Messages : 27
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France

Informations professionnelles :
Activité : Développeur Web
Secteur : Administration - Collectivité locale

Informations forums :
Inscription : mai 2011
Messages : 27
Points : 0
Points : 0
J'accède à cette adresse : http://localhost/Zend1.11.5/public
1-Dicible est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/05/2011, 15h05   #8
Modérateur
 
Inscription : septembre 2010
Messages : 7 103
Détails du profil
Informations forums :
Inscription : septembre 2010
Messages : 7 103
Points : 8 466
Points : 8 466
il faut créer ton vhost, comme le dit le tutoriel...
__________________
http://blog.stealth35.com/
stealth35 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/05/2011, 15h11   #9
Invité de passage
 
Homme
Développeur Web
Inscription : mai 2011
Messages : 27
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France

Informations professionnelles :
Activité : Développeur Web
Secteur : Administration - Collectivité locale

Informations forums :
Inscription : mai 2011
Messages : 27
Points : 0
Points : 0
J'ai une nouvelle erreur qui est apparut :

You don't have permission to access /Zend1.11.5/public/SdRequest on this server.
1-Dicible est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/05/2011, 15h12   #10
Modérateur
 
Inscription : septembre 2010
Messages : 7 103
Détails du profil
Informations forums :
Inscription : septembre 2010
Messages : 7 103
Points : 8 466
Points : 8 466
Citation:
Envoyé par stealth35 Voir le message
il faut créer ton vhost, comme le dit le tutoriel...
c'est simple il faut juste suivre le tutoriel, ça sert a rien d’essayé de bidouillé
__________________
http://blog.stealth35.com/
stealth35 est déconnecté   Envoyer un message privé Réponse avec citation 10
Vieux 03/05/2011, 15h23   #11
Invité de passage
 
Homme
Développeur Web
Inscription : mai 2011
Messages : 27
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France

Informations professionnelles :
Activité : Développeur Web
Secteur : Administration - Collectivité locale

Informations forums :
Inscription : mai 2011
Messages : 27
Points : 0
Points : 0
Oui ce problème résolu, encore une nouvelle erreur

Citation:
An error occurred
Application error
Exception information:
Message: Primary key column(s) ([CLE_INCIDENT]) are not columns in this table ()

Stack trace:
#0 C:\wamp\www\Zend1.11.5\library\Zend\Db\Table\Abstract.php(980): Zend_Db_Table_Abstract->_setupPrimaryKey()
#1 C:\wamp\www\Zend1.11.5\library\Zend\Db\Table\Select.php(100): Zend_Db_Table_Abstract->info()
#2 C:\wamp\www\Zend1.11.5\library\Zend\Db\Table\Select.php(78): Zend_Db_Table_Select->setTable(Object(Application_Model_DbTable_VueIncident))
#3 C:\wamp\www\Zend1.11.5\library\Zend\Db\Table\Abstract.php(1016): Zend_Db_Table_Select->__construct(Object(Application_Model_DbTable_VueIncident))
#4 C:\wamp\www\Zend1.11.5\library\Zend\Db\Table\Abstract.php(1324): Zend_Db_Table_Abstract->select()
#5 C:\wamp\www\Zend1.11.5\application\controllers\VueIncidentController.php(20): Zend_Db_Table_Abstract->fetchAll()
#6 C:\wamp\www\Zend1.11.5\library\Zend\Controller\Action.php(513): VueIncidentController->indexAction()
#7 C:\wamp\www\Zend1.11.5\library\Zend\Controller\Dispatcher\Standard.php(295): Zend_Controller_Action->dispatch('indexAction')
#8 C:\wamp\www\Zend1.11.5\library\Zend\Controller\Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#9 C:\wamp\www\Zend1.11.5\library\Zend\Application\Bootstrap\Bootstrap.php(97): Zend_Controller_Front->dispatch()
#10 C:\wamp\www\Zend1.11.5\library\Zend\Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#11 C:\wamp\www\Zend1.11.5\public\index.php(26): Zend_Application->run()
#12 {main} Request Parameters:
array (
'controller' => 'VueIncident',
'action' => 'index',
'module' => 'default',
)
Si j'ai bien compris, il me dit que la clé primaire n'est pas bonne ... le souci c'est que je n'est pas de clé primaire, c'est une vue.
1-Dicible est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/05/2011, 16h08   #12
Modérateur
 
Inscription : septembre 2010
Messages : 7 103
Détails du profil
Informations forums :
Inscription : septembre 2010
Messages : 7 103
Points : 8 466
Points : 8 466
pourquoi avoir mit des crochets ???
__________________
http://blog.stealth35.com/
stealth35 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/05/2011, 16h17   #13
Invité de passage
 
Homme
Développeur Web
Inscription : mai 2011
Messages : 27
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France

Informations professionnelles :
Activité : Développeur Web
Secteur : Administration - Collectivité locale

Informations forums :
Inscription : mai 2011
Messages : 27
Points : 0
Points : 0
Avec ou Sans sa ne change rien, vraiment compliqué ce Zend
1-Dicible est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/05/2011, 16h19   #14
Modérateur
 
Inscription : septembre 2010
Messages : 7 103
Détails du profil
Informations forums :
Inscription : septembre 2010
Messages : 7 103
Points : 8 466
Points : 8 466
Citation:
Envoyé par 1-Dicible Voir le message
Avec ou Sans sa ne change rien, vraiment compliqué ce Zend
non, mais pourquoi avoir mit
Code :
 protected $_primary = '[CLE_INCIDENT]';
si t'as pas de clé primaire ???
__________________
http://blog.stealth35.com/
stealth35 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/05/2011, 16h22   #15
Invité de passage
 
Homme
Développeur Web
Inscription : mai 2011
Messages : 27
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France

Informations professionnelles :
Activité : Développeur Web
Secteur : Administration - Collectivité locale

Informations forums :
Inscription : mai 2011
Messages : 27
Points : 0
Points : 0
Bin enfaite sur le manuel il dise qu'il faut obligatoirement une clé primaire, je me suis dit peut-être que sa forcé Zend à utiliser une clé primaire
1-Dicible est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/05/2011, 16h25   #16
Modérateur
 
Inscription : septembre 2010
Messages : 7 103
Détails du profil
Informations forums :
Inscription : septembre 2010
Messages : 7 103
Points : 8 466
Points : 8 466
Citation:
Envoyé par 1-Dicible Voir le message
Bin enfaite sur le manuel il dise qu'il faut obligatoirement une clé primaire, je me suis dit peut-être que sa forcé Zend à utiliser une clé primaire
c'est pas terrible de ne pas avoir de clé primaire dans un table, revoie le schéma de ta base
__________________
http://blog.stealth35.com/
stealth35 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/05/2011, 16h35   #17
Invité de passage
 
Homme
Développeur Web
Inscription : mai 2011
Messages : 27
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France

Informations professionnelles :
Activité : Développeur Web
Secteur : Administration - Collectivité locale

Informations forums :
Inscription : mai 2011
Messages : 27
Points : 0
Points : 0
Je ne sais pas comment faire
1-Dicible est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/05/2011, 16h48   #18
Modérateur
 
Inscription : septembre 2010
Messages : 7 103
Détails du profil
Informations forums :
Inscription : septembre 2010
Messages : 7 103
Points : 8 466
Points : 8 466
Citation:
Envoyé par 1-Dicible Voir le message
Je ne sais pas comment faire
c'est les bases du SQL ça, avant te lancer dans un projet soit bien sur d'avoir au moins les bases.
__________________
http://blog.stealth35.com/
stealth35 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/05/2011, 16h50   #19
Invité de passage
 
Homme
Développeur Web
Inscription : mai 2011
Messages : 27
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France

Informations professionnelles :
Activité : Développeur Web
Secteur : Administration - Collectivité locale

Informations forums :
Inscription : mai 2011
Messages : 27
Points : 0
Points : 0
bin enfaite j'ai déjà travailler avec MySQL mais pas SQL Server.
1-Dicible est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/05/2011, 16h55   #20
Modérateur
 
Inscription : septembre 2010
Messages : 7 103
Détails du profil
Informations forums :
Inscription : septembre 2010
Messages : 7 103
Points : 8 466
Points : 8 466
Citation:
Envoyé par 1-Dicible Voir le message
bin enfaite j'ai déjà travailler avec MySQL mais pas SQL Server.
c'est du SQL donc les fonctions de base sont les mêmes
__________________
http://blog.stealth35.com/
stealth35 est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 07h21.


 
 
 
 
Partenaires

Hébergement Web