IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Zend Framework PHP Discussion :

Fatal error : class not found


Sujet :

Zend Framework PHP

  1. #1
    Nouveau Candidat au Club
    Homme Profil pro
    Développeur Web
    Inscrit en
    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 : 1
    Points
    1
    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 : Sélectionner tout - Visualiser dans une fenêtre à part
    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 : Sélectionner tout - Visualiser dans une fenêtre à part
    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 : Sélectionner tout - Visualiser dans une fenêtre à part
    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 : Sélectionner tout - Visualiser dans une fenêtre à part
    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 : Sélectionner tout - Visualiser dans une fenêtre à part
    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

  2. #2
    Expert éminent sénior

    Profil pro
    Inscrit en
    Septembre 2010
    Messages
    7 920
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2010
    Messages : 7 920
    Points : 10 727
    Points
    10 727
    Par défaut
    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

  3. #3
    Nouveau Candidat au Club
    Homme Profil pro
    Développeur Web
    Inscrit en
    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 : 1
    Points
    1
    Par défaut
    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

  4. #4
    Expert éminent sénior

    Profil pro
    Inscrit en
    Septembre 2010
    Messages
    7 920
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2010
    Messages : 7 920
    Points : 10 727
    Points
    10 727
    Par défaut
    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

    Open a terminal (in Windows, Start -> Run, and then use cmd)

  5. #5
    Nouveau Candidat au Club
    Homme Profil pro
    Développeur Web
    Inscrit en
    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 : 1
    Points
    1
    Par défaut
    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 : Sélectionner tout - Visualiser dans une fenêtre à part
    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 : Sélectionner tout - Visualiser dans une fenêtre à part
    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

  6. #6
    Expert éminent sénior

    Profil pro
    Inscrit en
    Septembre 2010
    Messages
    7 920
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2010
    Messages : 7 920
    Points : 10 727
    Points
    10 727
    Par défaut
    t’accèdes à quelle adresse sur ton navigateur ?

  7. #7
    Nouveau Candidat au Club
    Homme Profil pro
    Développeur Web
    Inscrit en
    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 : 1
    Points
    1
    Par défaut
    J'accède à cette adresse : http://localhost/Zend1.11.5/public

  8. #8
    Expert éminent sénior

    Profil pro
    Inscrit en
    Septembre 2010
    Messages
    7 920
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2010
    Messages : 7 920
    Points : 10 727
    Points
    10 727
    Par défaut
    il faut créer ton vhost, comme le dit le tutoriel...

  9. #9
    Nouveau Candidat au Club
    Homme Profil pro
    Développeur Web
    Inscrit en
    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 : 1
    Points
    1
    Par défaut
    J'ai une nouvelle erreur qui est apparut :

    You don't have permission to access /Zend1.11.5/public/SdRequest on this server.

  10. #10
    Expert éminent sénior

    Profil pro
    Inscrit en
    Septembre 2010
    Messages
    7 920
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2010
    Messages : 7 920
    Points : 10 727
    Points
    10 727
    Par défaut
    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é

  11. #11
    Nouveau Candidat au Club
    Homme Profil pro
    Développeur Web
    Inscrit en
    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 : 1
    Points
    1
    Par défaut
    Oui ce problème résolu, encore une nouvelle erreur

    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.

  12. #12
    Expert éminent sénior

    Profil pro
    Inscrit en
    Septembre 2010
    Messages
    7 920
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2010
    Messages : 7 920
    Points : 10 727
    Points
    10 727
    Par défaut
    pourquoi avoir mit des crochets ???

  13. #13
    Nouveau Candidat au Club
    Homme Profil pro
    Développeur Web
    Inscrit en
    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 : 1
    Points
    1
    Par défaut
    Avec ou Sans sa ne change rien, vraiment compliqué ce Zend

  14. #14
    Expert éminent sénior

    Profil pro
    Inscrit en
    Septembre 2010
    Messages
    7 920
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2010
    Messages : 7 920
    Points : 10 727
    Points
    10 727
    Par défaut
    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 : Sélectionner tout - Visualiser dans une fenêtre à part
     protected $_primary = '[CLE_INCIDENT]';
    si t'as pas de clé primaire ???

  15. #15
    Nouveau Candidat au Club
    Homme Profil pro
    Développeur Web
    Inscrit en
    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 : 1
    Points
    1
    Par défaut
    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

  16. #16
    Expert éminent sénior

    Profil pro
    Inscrit en
    Septembre 2010
    Messages
    7 920
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2010
    Messages : 7 920
    Points : 10 727
    Points
    10 727
    Par défaut
    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

  17. #17
    Nouveau Candidat au Club
    Homme Profil pro
    Développeur Web
    Inscrit en
    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 : 1
    Points
    1
    Par défaut
    Je ne sais pas comment faire

  18. #18
    Expert éminent sénior

    Profil pro
    Inscrit en
    Septembre 2010
    Messages
    7 920
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2010
    Messages : 7 920
    Points : 10 727
    Points
    10 727
    Par défaut
    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.

  19. #19
    Nouveau Candidat au Club
    Homme Profil pro
    Développeur Web
    Inscrit en
    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 : 1
    Points
    1
    Par défaut
    bin enfaite j'ai déjà travailler avec MySQL mais pas SQL Server.

  20. #20
    Expert éminent sénior

    Profil pro
    Inscrit en
    Septembre 2010
    Messages
    7 920
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2010
    Messages : 7 920
    Points : 10 727
    Points
    10 727
    Par défaut
    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

Discussions similaires

  1. [ZF 1.11] Problème d'AutoLoad entre environnements - Fatal error: Class not found in
    Par eaglesnipe dans le forum Zend Framework
    Réponses: 4
    Dernier message: 22/03/2012, 09h15
  2. [2.x] Fatal error: Class not found
    Par sybil dans le forum Symfony
    Réponses: 8
    Dernier message: 04/04/2011, 10h16
  3. Fatal error class not found.
    Par billyrose dans le forum Langage
    Réponses: 4
    Dernier message: 23/04/2009, 17h22
  4. Eclipse 3.4.0: type error class not found : XrayLogger
    Par Ouaich75 dans le forum Eclipse Java
    Réponses: 1
    Dernier message: 13/10/2008, 15h31
  5. [MySQL] Fatal error: Class 'mysqli' not found in site
    Par rashid120 dans le forum PHP & Base de données
    Réponses: 1
    Dernier message: 29/07/2008, 08h42

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo