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

Symfony PHP Discussion :

Problème de Modification du formulaire


Sujet :

Symfony PHP

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé
    Inscrit en
    Octobre 2009
    Messages
    75
    Détails du profil
    Informations forums :
    Inscription : Octobre 2009
    Messages : 75
    Par défaut Problème de Modification du formulaire
    Bonjour,j'ai un problème avec l'édition de mon formulaire il m'indique toujours cette erreur :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
    500 | Internal Server Error | Doctrine_Table_Exception
    Unknown method TimesheetsTable::
    à vrai dire l'insertion des données se passe très bien voilà mon code :

    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
     
     
    $idTimesheet = $request->getParameter('id');
     
     $this->form = new TimesheetsForm(Doctrine::getTable('Timesheets')->find($idTimesheet),array('idUser' => $this->getUser()->getAttribute('id'),'Username' => $User['login']));
     
     
     
            if ($request->isMethod('post'))
            {
     
                if ($this->processForm($request, $this->form))
                {
     
                 $this->form->save();
       ....
    voilà mon template :

    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
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
     
    <div style="padding-bottom: 10px; margin-left: 10px;">
        <strong>Ajout d'une nouvelle tache : </strong> 
    </div>
    <form action="" method="post" id="form">
    <table >  
    <tr>
       <th>Client :</th>
       <th>Projet :</th>
       <th>De :</th>
       <th>A :</th>
       <th>Type :</th>
       <th>Etat :</th>
       <th>Tache :</th>
    </tr>
     
    <tr>
    <td><?php echo $form['projet']->render(array('class' => ($form['projet']->renderError()) ? 'inp-form-error' : 'timesheet-inp-form')); ?></td>
    <td><?php echo $form['n_estimation']->render(array('class' => ($form['n_estimation']->renderError()) ? 'inp-form-error' : 'timesheet-inp-form')); ?></td>
    <td><?php echo $form['date_debut']->render(array('class' => ($form['n_estimation']->renderError()) ? 'inp-form-error' : 'timesheet-inp-form')); ?></td>
    <td><?php echo $form['date_fin']->render(array('class' => ($form['n_estimation']->renderError()) ? 'inp-form-error' : 'timesheet-inp-form')); ?></td>
    <td><?php echo $form['id_ts_type']->render(array('class' => ($form['n_estimation']->renderError()) ? 'inp-form-error' : 'timesheet-inp-form')); ?></td>
    <td><?php echo $form['id_ts_etat']->render(array('class' => ($form['n_estimation']->renderError()) ? 'inp-form-error' : 'timesheet-inp-form')); ?></td>
    <td><?php echo $form['id_ts_tache']->render(array('class' => ($form['n_estimation']->renderError()) ? 'inp-form-error' : 'timesheet-inp-form')); ?></td>
    <td><input type="submit" value="" class="form-submit" /></td>
    <td><input type="reset" value="" class="form-reset"  /></td>
    </tr>
     
    <tr>
        <td><?php if ($form['projet']->renderError()): ?>
            <div class="error-left"></div>
            <div class="error-inner"><?php echo $form['projet']->renderError(); ?></div>
            <?php endif; ?>
     </td>
       <td><?php if ($form['n_estimation']->renderError()): ?>
            <div class="error-left"></div>
            <div class="error-inner"><?php echo $form['n_estimation']->renderError(); ?></div>
            <?php endif; ?></td>
          <td><?php if ($form['date_debut']->renderError()): ?>
            <div class="error-left"></div>
            <div class="error-inner"><?php echo $form['date_debut']->renderError(); ?></div>
            <?php endif; ?></td>
             <td><?php if ($form['date_fin']->renderError()): ?>
            <div class="error-left"></div>
            <div class="error-inner"><?php echo $form['date_fin']->renderError(); ?></div>
            <?php endif; ?></td>
                <td><?php if ($form['id_ts_type']->renderError()): ?>
            <div class="error-left"></div>
            <div class="error-inner"><?php echo $form['id_ts_type']->renderError(); ?></div>
            <?php endif; ?></td>
                   <td><?php if ($form['id_ts_etat']->renderError()): ?>
            <div class="error-left"></div>
            <div class="error-inner"><?php echo $form['id_ts_etat']->renderError(); ?></div>
            <?php endif; ?></td>
                      <td><?php if ($form['id_ts_tache']->renderError()): ?>
            <div class="error-left"></div>
            <div class="error-inner"><?php echo $form['id_ts_tache']->renderError(); ?></div>
            <?php endif; ?></td>
     
     
     
    </tr>
    </table>    
    </form>

    et voilà mon form :

    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
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
     
    class TimesheetsForm extends BaseTimesheetsForm {
     
        public function configure() {
            $this->disableCSRFProtection();
     
     
            // Boucle pour les types
            $q = Doctrine_Query::create()
                    ->select('tst.id_ts_type,tst.nom')
                    ->from('tsTypes tst');
     
            $res = $q->fetchArray();
     
            if ($res != null) 
            {
                foreach ($res as $ligne) 
                {
                    $liste_types[$ligne['id_ts_type']] = $ligne['nom'];
                }
            } 
            else 
            {
                $liste_types = array();
            }
            unset($res);
     
            // Boucle pour les etats
            $q = Doctrine_Query::create()
                    ->select('tse.id_ts_etat,tse.nom')
                    ->from('tsEtats tse');
     
            $res = $q->fetchArray();
     
            if ($res != null) 
            {
                foreach ($res as $ligne) 
                {
                    $liste_etats[$ligne['id_ts_etat']] = $ligne['nom'];
                }
            } 
            else 
            {
                $liste_etats = array();
            }
            unset($res);
     
            // Boucle pour les type taches
            $q = Doctrine_Query::create()
                    ->select('tsta.id_ts_tache,tsta.nom')
                    ->from('tsTaches tsta');
     
            $res = $q->fetchArray();
     
            if ($res != null) 
            {
                foreach ($res as $ligne) 
                {
                    if(strtolower($ligne['nom']) != 'evolution')
                        $liste_taches[$ligne['id_ts_tache']] = $ligne['nom'];
                }
            } 
            else 
            {
                $liste_taches = array();
            }
            unset($res);
     
     
     
     
     
     
     
                $projet = new sfWidgetFormDoctrineJQueryAutocompleter(array(
                        'url' => 'ajaxprojet.html',
                        'model' => 'Timesheets',
                        'method_for_query'=>''
     
                        ));
     
                $this->setWidget('projet', $projet);
     
             $estimation = new sfWidgetFormDoctrineJQueryAutocompleter(array(
                        'url' => 'ajaxestimation.html',
                        'model' => 'Timesheets',
                        'method_for_query'=>''
     
                        ));
     
                $this->setWidget('n_estimation', $estimation);
     
     
             //$this->widgetSchema['date_debut'] = new WidgetFormDateTime();
                $this->widgetSchema['date_debut']= new sfWidgetFormInput();
                  $this->widgetSchema['date_fin']= new sfWidgetFormInput();
             //$this->widgetSchema['date_fin'] = new WidgetFormDateTime();
     
     
     
     
            //$this->widgetSchema['date_fin'] = new sfWidgetFormDateTime(array('date' => array('format' => '%day%/%month%/%year%','years' => array_combine($years, $years))));
            $this->widgetSchema['id_ts_type'] = new sfWidgetFormSelect(array('choices' =>$liste_types));
            $this->widgetSchema['id_ts_etat'] = new sfWidgetFormSelect(array('choices' =>$liste_etats));
            $this->widgetSchema['id_ts_tache'] = new sfWidgetFormSelect(array('choices' =>$liste_taches));
            //  $this->widgetSchema['date_debut'] = new sfWidgetFormInput();
     
     
            //$this->setDefault('id_utilisateur', '20');
            $this->setDefault('date_debut', date("m/d/Y H:i"));
            $this->setDefault('date_fin', date("m/d/Y H:i"));
     
     
            $this->widgetSchema->setNameFormat('timesheets[%s]');
            $this->widgetSchema->setFormFormatterName('custom');
     
        }

    et voilà mon schema :

    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
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
     
    Timesheets:
      connection: doctrine
      tableName: timesheets
      columns:
        id_timesheet:
          type: integer(8)
          fixed: false
          unsigned: false
          primary: true
          autoincrement: true
        titre:
          type: string()
          fixed: false
          unsigned: false
          primary: false
          notnull: false
          autoincrement: false
        id_client:
          type: integer(8)
          fixed: false
          unsigned: false
          primary: false
          notnull: false
          autoincrement: false
        id_estimation:
          type: integer(8)
          fixed: false
          unsigned: false
          primary: false
          notnull: false
          autoincrement: false
        id_utilisateur:
          type: integer(8)
          fixed: false
          unsigned: false
          primary: false
          notnull: false
          autoincrement: false
        projet:
          type: string(50)
          fixed: false
          unsigned: false
          primary: false
          notnull: true
          autoincrement: false
        n_estimation:
          type: integer(4)
          fixed: false
          unsigned: false
          primary: false
          notnull: false
          autoincrement: false
        date_debut:
          type: timestamp(25)
          fixed: false
          unsigned: false
          primary: false
          notnull: true
          autoincrement: false
        date_fin:
          type: timestamp(25)
          fixed: false
          unsigned: false
          primary: false
          notnull: true
          autoincrement: false
        id_ts_type:
          type: integer(8)
          fixed: false
          unsigned: false
          primary: false
          notnull: false
          autoincrement: false
        id_ts_etat:
          type: integer(8)
          fixed: false
          unsigned: false
          primary: false
          notnull: false
          autoincrement: false
        id_ts_tache:
          type: integer(8)
          fixed: false
          unsigned: false
          primary: false
          notnull: false
          autoincrement: false
        description:
          type: string()
          fixed: false
          unsigned: false
          primary: false
          notnull: false
          autoincrement: false
      relations:
        Estimations:
          local: id_estimation
          foreign: id_estimation
          type: one
        TsTypes:
          local: id_ts_type
          foreign: id_ts_type
          type: one
        TsEtats:
          local: id_ts_etat
          foreign: id_ts_etat
          type: one
        TsTaches:
          local: id_ts_tache
          foreign: id_ts_tache
          type: one
        Utilisateurs:
          local: id_utilisateur
          foreign: id_utilisateur
          type: one
        Clients:
          local: id_client
          foreign: id_client
          type: one
    Une idée??

  2. #2
    Membre émérite Avatar de kenny.kev
    Homme Profil pro
    Inscrit en
    Janvier 2007
    Messages
    646
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : France, Indre et Loire (Centre)

    Informations professionnelles :
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Janvier 2007
    Messages : 646
    Par défaut
    il existe ton fichier TimesheetsTable ?

  3. #3
    Membre confirmé
    Inscrit en
    Octobre 2009
    Messages
    75
    Détails du profil
    Informations forums :
    Inscription : Octobre 2009
    Messages : 75
    Par défaut
    Je te remercie pour ta réponse à chaque fois et ton aide,oui bien sur la classe timesheetsTable existe dans model/doctrine/timesheetsTable.class.php??

    Vraiment je ne comprend pas ou est le problème...

  4. #4
    Membre émérite Avatar de kenny.kev
    Homme Profil pro
    Inscrit en
    Janvier 2007
    Messages
    646
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : France, Indre et Loire (Centre)

    Informations professionnelles :
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Janvier 2007
    Messages : 646
    Par défaut
    ton fichier est bien écrit comme cela timesheetsTable.class.php ? prise en compte de la casse.

    Et ta classe est avec des majuscules "TimesheetsTable"
    Tu as bien générer le model avec la commande symfony ?
    (php symfony doctrine:build-model)

  5. #5
    Membre confirmé
    Inscrit en
    Octobre 2009
    Messages
    75
    Détails du profil
    Informations forums :
    Inscription : Octobre 2009
    Messages : 75
    Par défaut
    Oui tout cela est bien fait Kenny et je l'ai revérifié encore!!

  6. #6
    Membre émérite Avatar de kenny.kev
    Homme Profil pro
    Inscrit en
    Janvier 2007
    Messages
    646
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : France, Indre et Loire (Centre)

    Informations professionnelles :
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Janvier 2007
    Messages : 646
    Par défaut
    Si j'ai bien compris le nom du fichier n'est pas le même que le nom de la classe ?
    La classe est très important.

    Il faut que ce soit le même. As-tu utilisé la commande ?

Discussions similaires

  1. Problème de modification de tables via un formulaire
    Par maxmusix dans le forum VBA Access
    Réponses: 1
    Dernier message: 27/05/2013, 16h08
  2. [Débutant] Problème au niveau de modification de formulaire
    Par mekup dans le forum VB.NET
    Réponses: 0
    Dernier message: 11/04/2013, 13h23
  3. Réponses: 2
    Dernier message: 31/05/2012, 01h01
  4. [débutant] Problème JSplitPane (modif :InternalFrame)
    Par pingoui dans le forum Agents de placement/Fenêtres
    Réponses: 61
    Dernier message: 03/09/2004, 17h01
  5. [HTML] Problème d'envoi de formulaire
    Par autumn319 dans le forum ASP
    Réponses: 26
    Dernier message: 03/09/2003, 10h06

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