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

MkFramework Discussion :

method new avec des tables liées (HELP)


Sujet :

MkFramework

  1. ###raw>post.musername###
    Membre habitué
    method new avec des tables liées (HELP)
    La table 'saisir' est lié aux tables prn,autres,courrier,dsij,echeancier,kdc,pe non subro,pe subro recla.
    Ou est mon erreur?
    Voici le main du module saisir pour la methode new :
    public function _new(){
    $tMessage=$this->processSave();

    $oSaisir=new row_saisir;
    $oAutres=new row_autres;
    $oCourrier=new row_courrier;
    $oDsij=new row_dsij;
    $oEcheancier=new row_echeancier;
    $oKdc=new row_kdc;
    $oPens=new row_pe_non_subro;
    $oPes=new row_pe_subro;
    $oPrn=new row_prn;
    $oRecla=new row_recla;


    $oView=new _view('saisir::new');
    //on recupere l'user_id de l'agent connecté
    $oSaisir->user_id = _root::getAuth()->getAccount()->id;

    $oView->oSaisir=$oSaisir;
    $oView->oAutres=$oAutres;
    $oView->oCourrier=$oCourrier;
    $oView->oDsij=$oDsij;
    $oView->oEcheancier=$oEcheancier;
    $oView->oKdc=$oKdc;
    $oView->oPens=$oPens;
    $oView->oPes=$oPes;
    $oView->oPrn=$oPrn;
    $oView->oRecla=$oRecla;


    $oPluginXsrf=new plugin_xsrf();
    $oView->token=$oPluginXsrf->getToken();
    $oView->tMessage=$tMessage;

    $this->oLayout->add('main',$oView);
    }


    private function processSave(){
    if(!_root::getRequest()->isPost() ){ //si ce n'est pas une requete POST on ne soumet pas
    return null;
    }

    $oPluginXsrf=new plugin_xsrf();
    if(!$oPluginXsrf->checkToken( _root::getParam('token') ) ){ //on verifie que le token est valide
    return array('token'=>$oPluginXsrf->getMessage() );
    }

    $iId=_root::getParam('id');

    //$iUser_id= _root::getAuth()->getAccount()->id;

    if($iId==null){

    $oSaisir=new row_saisir;

    $oAutres=new row_autres;
    $oCourrier=new row_courrier;
    $oDsij=new row_dsij;
    $oEcheancier=new row_echeancier;
    $oKdc=new row_kdc;
    $oPens=new row_pe_non_subro;
    $oPes=new row_pe_subro;
    $oPrn=new row_prn;
    $oRecla=new row_recla;

    }else{

    $oSaisir=model_saisir::getInstance()->findById($iId);
    $oAutres=model_autres::getInstance()->findById($iId);
    $oCourrier=model_courrier::getInstance()->findById($iId);
    $oDsij=model_dsij::getInstance()->findById($iId);
    $oEcheancier=model_echeancier::getInstance()->findById($iId);
    $oKdc=model_kdc::getInstance()->findById($iId);
    $oPens=model_pe_non_subro::getInstance()->findById($iId);
    $oPes=model_pe_subro::getInstance()->findById($iId);
    $oPrn=model_prn::getInstance()->findById($iId);
    $oRecla=model_recla::getInstance()->findById($iId);
    }

    $tColumn1=array('prn_aas','prn_pas','prn_personnel','prn_rejet','prn_sigmt');

    foreach($tColumn1 as $sColumn1){
    $oPrn->$sColumn1=_root::getParam($sColumn1,null);
    $var_prn=$oPrn->prn_id;
    }
    var_dump($var_prn);
    $tColumn2=array('autres_pj_diad','autres_lm2a','autres_destin','autres_ij_amexa','autres_indus','autres_rejet_diad','autres_solde_papier');

    foreach($tColumn2 as $sColumn2){
    $oAutres->$sColumn2=_root::getParam($sColumn2,null) ;
    }
    var_dump($oAutres);
    $tColumn3=array('courrier_ave','courrier_sanction50','courrier_sanction100','courrier_retour');

    foreach($tColumn3 as $sColumn3){
    $oCourrier->$sColumn3=_root::getParam($sColumn3,null) ;
    }
    var_dump($oCourrier);
    $tColumn4=array('dsij_auto','dsij_manuel');

    foreach($tColumn4 as $sColumn4){
    $oDsij->$sColumn4=_root::getParam($sColumn4,null) ;
    }
    var_dump($oDsij);
    $tColumn5=array('echeancier_ok','echeancier_rejet','echeancier_relance');

    foreach($tColumn5 as $sColumn5){
    $oEcheancier->$sColumn5=_root::getParam($sColumn5,null) ;
    }
    var_dump($oEcheancier);
    $tColumn6=array('kdc_paiement','kdc_rejets');

    foreach($tColumn6 as $sColumn6){
    $oKdc->$sColumn6=_root::getParam($sColumn6,null) ;
    }
    var_dump($oKdc);
    $tColumn7=array('pe_non_subro_mal','pe_non_subro_mat_pat','pe_non_subro_pamc');

    foreach($tColumn7 as $sColumn7){
    $oPens->$sColumn7=_root::getParam($sColumn7,null) ;
    }
    var_dump($oPens);
    $tColumn8=array('pe_subro_mal','pe_subro_mat_pat','pe_subro_ij_personnel');

    foreach($tColumn8 as $sColumn8){
    $oPes->$sColumn8=_root::getParam($sColumn8,null) ;
    }
    var_dump($oPes);
    $tColumn9=array('recla_medialog','recla_eptica','recla_bal','recla_diad','recla_ass');

    foreach($tColumn9 as $sColumn9){
    $oRecla->$sColumn9=_root::getParam($sColumn9,null) ;
    }
    var_dump($oRecla);

    $tColumn=array('user_id','saisir_date','saisir_absence','dysf_panne_info','observations','saisir_prn_id','saisir_autres_id','saisir_courrier_id','saisir_dsij_id','saisir_echeancier_id','saisir_kdc_id','saisir_pe_non_subro_id','saisir_pe_subro_id','saisir_recla_id');

    foreach($tColumn as $sColumn){
    $oSaisir->$sColumn=_root::getParam($sColumn,null) ;
    }
    var_dump($oSaisir);

    if($oSaisir->save() and $oPrn->save() and $oAutres->save() and $oCourrier->save() and $oDsij->save() and $oEcheancier->save() and $oKdc->save() and $oPens->save() and $oPes->save() and $oRecla->save()){
    //une fois enregistre on redirige (vers la page liste)
    _root::redirect('saisir::list');
    }else{
    return $oSaisir->getListError();
    }

    }

    Voici la vue du new
    <?php
    plugin_debug::addSpy('tMess',$this->tMessage);
    $oForm=new plugin_form($this->oSaisir);
    $oForm->setMessage($this->tMessage);
    ?>
    <div class="container">
    <header class="page-header">
    <h2 class="text-center">GROUPE IJ - FICHE STATISTIQUES JOURNALIERES</h2>
    </header>
    <br/>

    <form role="form" action="" method="POST" >
    <div class="row">
    <section class="col-sm-4">
    <div class="form-group text-center">
    <label class="control-label ">En date du</label>
    <?php echo $oForm->getInputText('saisir_date',array('class'=>'form-control text-center','placeholder'=> 'JJ/MM/AAAA','autocomplete'=>'off','data-provide' =>'datepicker','id'=>'sandbox-container')) ?>
    </div>
    </section>
    <section class="col-sm-4">
    <div class="form-group text-center">
    <label class="control-label">Absence</label>
    <?php echo $oForm->getInputText('saisir_absence',array('class'=>'form-control text-center','placeholder'=> '0.5 ou 1','autocomplete'=>'off')) ?>
    </div>
    </section>
    <section class="col-sm-4">
    <div class="form-group text-center">
    <label class="control-label">Problème informatique</label>
    <?php echo $oForm->getInputText('dysf_panne_info',array('class'=>'form-control text-center','placeholder'=> 'en minutes','autocomplete'=>'off')) ?>
    </div>
    </section>
    </div>

    <div class="row">
    <section class="col-sm-12">
    <div class="form-group">
    <label class="sr-only" for="observations">Observations</label>
    <?php echo $oForm->getInputTextarea('observations',array('class'=>'form-control text-center','id'=>'observations','placeholder'=> 'Observations','rows'=>"5",'autocomplete'=>'off')) ?>
    </div>
    </section>
    </div>


    <div class="row ">
    <section class="col-sm-4 table-responsive">
    <table class="table table-bordered table-striped table-condensed">
    <thead>
    <tr>
    <th colspan="2" class="text-center"><h4>PRN</h4></th>
    </tr>
    </thead>
    <tbody>
    <tr>
    <td>AAS</td>
    <td><?php echo $oForm->getInputText('prn_aas',array('class'=>'form-control text-center','autocomplete'=>'off')) ?></td>
    </tr>
    <tr>
    <td>PAS</td>
    <td><?php echo $oForm->getInputText('prn_pas',array('class'=>'form-control text-center','autocomplete'=>'off')) ?></td>
    </tr>
    <tr>
    <td>PERSONNEL</td>
    <td><?php echo $oForm->getInputText('prn_personnel',array('class'=>'form-control text-center','autocomplete'=>'off')) ?></td>
    </tr>
    <tr>
    <td>REJET</td>
    <td><?php echo $oForm->getInputText('prn_rejet',array('class'=>'form-control text-center','autocomplete'=>'off')) ?></td>
    </tr>
    <tr>
    <td>SIGNALEMENT</td>
    <td><?php echo $oForm->getInputText('prn_sigmt',array('class'=>'form-control text-center','autocomplete'=>'off')) ?></td>
    </tr>
    </tbody>
    </table>
    </section>

    <section class="col-sm-4 table-responsive">
    <table class="table table-bordered table-striped table-condensed">
    <thead>
    <tr>
    <th colspan="2" class="text-center"><h4>AUTRES</h4></th>
    </tr>
    </thead>
    <tbody>
    <tr>
    <td>PJ DIADEME</td>
    <td><?php echo $oForm->getInputText('autres_pj_diad',array('class'=>'form-control text-center','autocomplete'=>'off')) ?></td>
    </tr>
    <tr>
    <td>LM2A</td>
    <td><?php echo $oForm->getInputText('autres_lm2a',array('class'=>'form-control text-center','autocomplete'=>'off')) ?></td>
    </tr>
    <tr>
    <td>DESTIN</td>
    <td><?php echo $oForm->getInputText('autres_destin',array('class'=>'form-control text-center','autocomplete'=>'off')) ?></td>
    </tr>
    <tr>
    <td>IJ AMEXA</td>
    <td><?php echo $oForm->getInputText('autres_ij_amexa',array('class'=>'form-control text-center','autocomplete'=>'off')) ?></td>
    </tr>
    <tr>
    <td>INDUS</td>
    <td><?php echo $oForm->getInputText('autres_indus',array('class'=>'form-control text-center','autocomplete'=>'off')) ?></td>
    </tr>
    <tr>
    <td>REJETS DIADEME</td>
    <td><?php echo $oForm->getInputText('autres_rejet_diad',array('class'=>'form-control text-center','autocomplete'=>'off')) ?></td>
    </tr>
    <tr>
    <td>SOLDE PAPIER</td>
    <td><?php echo $oForm->getInputText('autres_solde_papier',array('class'=>'form-control text-center','autocomplete'=>'off')) ?></td>
    </tr>
    </tbody>
    </table>
    </section>

    <section class="col-sm-4 table-responsive">
    <table class="table table-bordered table-striped table-condensed">
    <thead>
    <tr>
    <th colspan="2" class="text-center"><h4>NON SUBRO</h4></th>
    </tr>
    </thead>
    <tbody>
    <tr>
    <td>MAL</td>
    <td><?php echo $oForm->getInputText('pe_non_subro_mal',array('class'=>'form-control text-center','autocomplete'=>'off')) ?></td>
    </tr>
    <tr>
    <td>MAT / PAT</td>
    <td><?php echo $oForm->getInputText('pe_non_subro_mat_pat',array('class'=>'form-control text-center','autocomplete'=>'off')) ?></td>
    </tr>
    <tr>
    <td>PAMC</td>
    <td><?php echo $oForm->getInputText('pe_non_subro_pamc',array('class'=>'form-control text-center','autocomplete'=>'off')) ?></td>
    </tr>
    </tbody>
    </table>
    </section>
    </div>

    <div class="row ">
    <section class="col-sm-4 table-responsive">
    <table class="table table-bordered table-striped table-condensed">
    <thead>
    <tr>
    <th colspan="2" class="text-center"><h4>RECLAMATIONS</h4></th>
    </tr>
    </thead>
    <tbody>
    <tr>
    <td>MEDIALOG</td>
    <td><?php echo $oForm->getInputText('recla_medialog',array('class'=>'form-control text-center','autocomplete'=>'off')) ?></td>
    </tr>
    <tr>
    <td>EPTICA</td>
    <td><?php echo $oForm->getInputText('recla_eptica',array('class'=>'form-control text-center','autocomplete'=>'off')) ?></td>
    </tr>
    <tr>
    <td>BAL RECLA</td>
    <td><?php echo $oForm->getInputText('recla_bal',array('class'=>'form-control text-center','autocomplete'=>'off')) ?></td>
    </tr>
    <tr>
    <td>RECLA DIADEME</td>
    <td><?php echo $oForm->getInputText('recla_diad',array('class'=>'form-control text-center','autocomplete'=>'off')) ?></td>
    </tr>
    <tr>
    <td>RECLA ASSURE</td>
    <td><?php echo $oForm->getInputText('recla_ass',array('class'=>'form-control text-center','autocomplete'=>'off')) ?></td>
    </tr>
    </tbody>
    </table>
    </section>

    <section class="col-sm-4 table-responsive">
    <table class="table table-bordered table-striped table-condensed">
    <thead>
    <tr>
    <th colspan="2" class="text-center"><h4>DSIJ</h4></th>
    </tr>
    </thead>
    <tbody>
    <tr>
    <td>AUTO</td>
    <td><?php echo $oForm->getInputText('dsij_auto',array('class'=>'form-control text-center','autocomplete'=>'off')) ?></td>
    </tr>
    <tr>
    <td>MANUEL</td>
    <td><?php echo $oForm->getInputText('dsij_manuel',array('class'=>'form-control text-center','autocomplete'=>'off')) ?></td>
    </tr>
    </tbody>
    </table>
    </section>

    <section class="col-sm-4 table-responsive">
    <table class="table table-bordered table-striped table-condensed">
    <thead>
    <tr>
    <th colspan="2" class="text-center"><h4>SUBRO</h4></th>
    </tr>
    </thead>
    <tbody>
    <tr>
    <td>MAL</td>
    <td><?php echo $oForm->getInputText('pe_subro_mal',array('class'=>'form-control text-center','autocomplete'=>'off')) ?></td>
    </tr>
    <tr>
    <td>MAT / PAT</td>
    <td><?php echo $oForm->getInputText('pe_subro_mat_pat',array('class'=>'form-control text-center','autocomplete'=>'off')) ?></td>
    </tr>
    <tr>
    <td>IJ PERSONNEL</td>
    <td><?php echo $oForm->getInputText('pe_subro_ij_personnel',array('class'=>'form-control text-center','autocomplete'=>'off')) ?></td>
    </tr>
    </tbody>
    </table>
    </section>
    </div>

    <div class="row ">
    <section class="col-sm-4 table-responsive">
    <table class="table table-bordered table-striped table-condensed">
    <thead>
    <tr>
    <th colspan="2" class="text-center"><h4>COURRIERS</h4></th>
    </tr>
    </thead>
    <tbody>
    <tr>
    <td>AVE</td>
    <td><?php echo $oForm->getInputText('courrier_ave',array('class'=>'form-control text-center','autocomplete'=>'off')) ?></td>
    </tr>
    <tr>
    <td>SANCTION 50</td>
    <td><?php echo $oForm->getInputText('courrier_sanction50',array('class'=>'form-control text-center','autocomplete'=>'off')) ?></td>
    </tr>
    <tr>
    <td>SANCTION 100</td>
    <td><?php echo $oForm->getInputText('courrier_sanction100',array('class'=>'form-control text-center','autocomplete'=>'off')) ?></td>
    </tr>
    <tr>
    <td>RETOUR COURRIER</td>
    <td><?php echo $oForm->getInputText('courrier_retour',array('class'=>'form-control text-center','autocomplete'=>'off')) ?></td>
    </tr>
    </tbody>
    </table>
    </section>

    <section class="col-sm-4 table-responsive">
    <table class="table table-bordered table-striped table-condensed">
    <thead>
    <tr>
    <th colspan="2" class="text-center"><h4>KDC</h4></th>
    </tr>
    </thead>
    <tbody>
    <tr>
    <td>PAIEMENT</td>
    <td><?php echo $oForm->getInputText('kdc_paiement',array('class'=>'form-control text-center','autocomplete'=>'off')) ?></td>
    </tr>
    <tr>
    <td>REJETS/td>
    <td><?php echo $oForm->getInputText('kdc_rejets',array('class'=>'form-control text-center','autocomplete'=>'off')) ?></td>
    </tr>
    </tbody>
    </table>
    </section>

    <section class="col-sm-4 table-responsive">
    <table class="table table-bordered table-striped table-condensed">
    <thead>
    <tr>
    <th colspan="2" class="text-center"><h4>ECHEANCIER</h4></th>
    </tr>
    </thead>
    <tbody>
    <tr>
    <td>OK</td>
    <td><?php echo $oForm->getInputText('echeancier_ok',array('class'=>'form-control text-center','autocomplete'=>'off')) ?></td>
    </tr>
    <tr>
    <td>REJET</td>
    <td><?php echo $oForm->getInputText('echeancier_rejet',array('class'=>'form-control text-center','autocomplete'=>'off')) ?></td>
    </tr>
    <tr>
    <td>RELANCE</td>
    <td><?php echo $oForm->getInputText('echeancier_relance',array('class'=>'form-control text-center','autocomplete'=>'off')) ?></td>
    </tr>
    </tbody>
    </table>
    </section>
    </div>

    </div>

    <div class="form-group">
    <?php echo $oForm->getInputHidden('user_id') ?>
    <?php echo $oForm->getInputHidden('saisir_prn_id') ?>
    <?php echo $oForm->getInputHidden('saisir_autres_id') ?>
    <?php echo $oForm->getInputHidden('saisir_courrier_id') ?>
    <?php echo $oForm->getInputHidden('saisir_dsij_id') ?>
    <?php echo $oForm->getInputHidden('saisir_echeancier_id') ?>
    <?php echo $oForm->getInputHidden('saisir_kdc_id') ?>
    <?php echo $oForm->getInputHidden('saisir_pe_non_subro_id') ?>
    <?php echo $oForm->getInputHidden('saisir_pe_subro_id') ?>
    <?php echo $oForm->getInputHidden('saisir_recla_id') ?>
    <?php echo $oForm->getInputHidden('prn_id') ?>
    <?php echo $oForm->getInputHidden('autres_id') ?>
    <?php echo $oForm->getInputHidden('courrier_id') ?>
    <?php echo $oForm->getInputHidden('dsij_id') ?>
    <?php echo $oForm->getInputHidden('echeancier_id') ?>
    <?php echo $oForm->getInputHidden('kdc_id') ?>
    <?php echo $oForm->getInputHidden('pe_non_subro_id') ?>
    <?php echo $oForm->getInputHidden('pe_subro_id') ?>
    <?php echo $oForm->getInputHidden('recla_id') ?>
    </div>

    <?php echo $oForm->getToken('token',$this->token)?>

    <div class="container">
    <div class="form-group">
    <div class="col-sm-12">
    <input type="submit" class="btn btn-success" value="Ajouter" /> <a class="btn btn-link" href="<?php echo $this->getLink('saisir::list')?>">Annuler</a>
    </div>
    </div>
    </div>
    </form>
    </div>

    Voici le message d'erreur:
    NULL object(row_autres)#12 (4) { ["sClassModel":protected]=> string(12) "model_autres" ["_bChooseUpdate":"abstract_row":private]=> bool(false) ["_tProperty":protected]=> array(7) { ["autres_pj_diad"]=> string(1) "0" ["autres_lm2a"]=> string(1) "0" ["autres_destin"]=> string(1) "0" ["autres_ij_amexa"]=> string(1) "0" ["autres_indus"]=> string(1) "0" ["autres_rejet_diad"]=> string(1) "0" ["autres_solde_papier"]=> string(1) "0" } ["_tPropertyToUpdate":protected]=> array(7) { [0]=> string(14) "autres_pj_diad" [1]=> string(11) "autres_lm2a" [2]=> string(13) "autres_destin" [3]=> string(15) "autres_ij_amexa" [4]=> string(12) "autres_indus" [5]=> string(17) "autres_rejet_diad" [6]=> string(19) "autres_solde_papier" } } object(row_courrier)#13 (4) { ["sClassModel":protected]=> string(14) "model_courrier" ["_bChooseUpdate":"abstract_row":private]=> bool(false) ["_tProperty":protected]=> array(4) { ["courrier_ave"]=> string(1) "0" ["courrier_sanction50"]=> string(1) "0" ["courrier_sanction100"]=> string(1) "0" ["courrier_retour"]=> string(1) "0" } ["_tPropertyToUpdate":protected]=> array(4) { [0]=> string(12) "courrier_ave" [1]=> string(19) "courrier_sanction50" [2]=> string(20) "courrier_sanction100" [3]=> string(15) "courrier_retour" } } object(row_dsij)#14 (4) { ["sClassModel":protected]=> string(10) "model_dsij" ["_bChooseUpdate":"abstract_row":private]=> bool(false) ["_tProperty":protected]=> array(2) { ["dsij_auto"]=> string(1) "0" ["dsij_manuel"]=> string(1) "0" } ["_tPropertyToUpdate":protected]=> array(2) { [0]=> string(9) "dsij_auto" [1]=> string(11) "dsij_manuel" } } object(row_echeancier)#15 (4) { ["sClassModel":protected]=> string(16) "model_echeancier" ["_bChooseUpdate":"abstract_row":private]=> bool(false) ["_tProperty":protected]=> array(3) { ["echeancier_ok"]=> string(1) "0" ["echeancier_rejet"]=> string(1) "0" ["echeancier_relance"]=> string(1) "0" } ["_tPropertyToUpdate":protected]=> array(3) { [0]=> string(13) "echeancier_ok" [1]=> string(16) "echeancier_rejet" [2]=> string(18) "echeancier_relance" } } object(row_kdc)#16 (4) { ["sClassModel":protected]=> string(9) "model_kdc" ["_bChooseUpdate":"abstract_row":private]=> bool(false) ["_tProperty":protected]=> array(2) { ["kdc_paiement"]=> string(1) "0" ["kdc_rejets"]=> string(1) "0" } ["_tPropertyToUpdate":protected]=> array(2) { [0]=> string(12) "kdc_paiement" [1]=> string(10) "kdc_rejets" } } object(row_pe_non_subro)#17 (4) { ["sClassModel":protected]=> string(18) "model_pe_non_subro" ["_bChooseUpdate":"abstract_row":private]=> bool(false) ["_tProperty":protected]=> array(3) { ["pe_non_subro_mal"]=> string(1) "0" ["pe_non_subro_mat_pat"]=> string(1) "0" ["pe_non_subro_pamc"]=> string(1) "0" } ["_tPropertyToUpdate":protected]=> array(3) { [0]=> string(16) "pe_non_subro_mal" [1]=> string(20) "pe_non_subro_mat_pat" [2]=> string(17) "pe_non_subro_pamc" } } object(row_pe_subro)#18 (4) { ["sClassModel":protected]=> string(14) "model_pe_subro" ["_bChooseUpdate":"abstract_row":private]=> bool(false) ["_tProperty":protected]=> array(3) { ["pe_subro_mal"]=> string(1) "0" ["pe_subro_mat_pat"]=> string(1) "0" ["pe_subro_ij_personnel"]=> string(1) "0" } ["_tPropertyToUpdate":protected]=> array(3) { [0]=> string(12) "pe_subro_mal" [1]=> string(16) "pe_subro_mat_pat" [2]=> string(21) "pe_subro_ij_personnel" } } object(row_recla)#20 (4) { ["sClassModel":protected]=> string(11) "model_recla" ["_bChooseUpdate":"abstract_row":private]=> bool(false) ["_tProperty":protected]=> array(5) { ["recla_medialog"]=> string(1) "0" ["recla_eptica"]=> PDOStatement::execute(): SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`prestations_especes`.`prn`, CONSTRAINT `prn_ibfk_1` FOREIGN KEY (`prn_id`) REFERENCES `saisir` (`saisir_prn_id`) ON DELETE CASCADE ON UPDATE CASCADE)
    #0 [internal function]: exception_error_handler(2, 'PDOStatement::e...', 'C:\\xampp\\htdocs...', 251, Array)
    #1 C:\xampp\htdocs\9-mkFramework\mkframework_v4_125_3_r306\lib\framework\abstract\abstract_sgbd_pdo.php(251): PDOStatement->execute(Array)
    #2 C:\xampp\htdocs\9-mkFramework\mkframework_v4_125_3_r306\lib\framework\abstract\abstract_sgbd_pdo.php(210): abstract_sgbd_pdo->query('INSERT INTO prn...', Array)
    #3 C:\xampp\htdocs\9-mkFramework\mkframework_v4_125_3_r306\lib\framework\abstract\abstract_model.php(178): abstract_sgbd_pdo->insert('prn', Array)
    #4 C:\xampp\htdocs\9-mkFramework\mkframework_v4_125_3_r306\lib\framework\abstract\abstract_row.php(71): abstract_model->insert(Object(row_prn))
    #5 C:\xampp\htdocs\9-mkFramework\mkframework_v4_125_3_r306\lib\framework\abstract\abstract_row.php(56): abstract_row->insert()
    #6 C:\xampp\htdocs\9-mkFramework\mkframework_v4_125_3_r306\data\genere\PRESTATIONS_ESPECES\model\model_prn.php(68): abstract_row->save()
    #7 C:\xampp\htdocs\9-mkFramework\mkframework_v4_125_3_r306\data\genere\PRESTATIONS_ESPECES\module\saisir\main.php(346): row_prn->save()
    #8 C:\xampp\htdocs\9-mkFramework\mkframework_v4_125_3_r306\data\genere\PRESTATIONS_ESPECES\module\saisir\main.php(127): module_saisir->processSave()
    #9 C:\xampp\htdocs\9-mkFramework\mkframework_v4_125_3_r306\lib\framework\class_root.php(263): module_saisir->_new()
    #10 C:\xampp\htdocs\9-mkFramework\mkframework_v4_125_3_r306\data\genere\PRESTATIONS_ESPECES\public\index.php(47): _root->run()
    #11 {main}

    Detail:
    #0 exception_error_handler( , 'PDOStatement::execute(): SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`prestations_especes`.`prn`, CONSTRAINT `prn_ibfk_1` FOREIGN KEY (`prn_id`) REFERENCES `saisir` (`saisir_prn_id`) ON DELETE CASCADE ON UPDATE CASCADE)' , 'C:\xampp\htdocs\9-mkFramework\mkframework_v4_125_3_r306\lib\framework\abstract\abstract_sgbd_pdo.php' , , Array ( [sReq] => INSERT INTO prn (prn_aas,prn_pas,prn_personnel,prn_rejet,prn_sigmt) VALUES (?,?,?,?,?) [tParam] => Array ( [0] => 0 [1] => 0 [2] => 0 [3] => 0 [4] => 0 ) [tATTRERRMODE] => Array ( [SILENT] => 0 [WARNING] => 1 [EXCEPTION] => 2 ) [tATTRCASE] => Array ( [LOWER] => 2 [NATURAL] => 0 [UPPER] => 1 ) [sth] => PDOStatement Object ( [queryString] => INSERT INTO prn (prn_aas,prn_pas,prn_personnel,prn_rejet,prn_sigmt) VALUES (?,?,?,?,?) ) ) )
    #1 C:\xampp\htdocs\9-mkFramework\mkframework_v4_125_3_r306\lib\framework\abstract\abstract_sgbd_pdo.php (251)
    PDOStatement -> execute( Array ( [0] => 0 [1] => 0 [2] => 0 [3] => 0 [4] => 0 ) )
    #2 C:\xampp\htdocs\9-mkFramework\mkframework_v4_125_3_r306\lib\framework\abstract\abstract_sgbd_pdo.php (210)
    abstract_sgbd_pdo -> query( 'INSERT INTO prn (prn_aas,prn_pas,prn_personnel,prn_rejet,prn_sigmt) VALUES (?,?,?,?,?) ' , Array ( [0] => 0 [1] => 0 [2] => 0 [3] => 0 [4] => 0 ) )
    #3 C:\xampp\htdocs\9-mkFramework\mkframework_v4_125_3_r306\lib\framework\abstract\abstract_model.php (178)
    abstract_sgbd_pdo -> insert( 'prn' , Array ( [prn_aas] => 0 [prn_pas] => 0 [prn_personnel] => 0 [prn_rejet] => 0 [prn_sigmt] => 0 ) )
    #4 C:\xampp\htdocs\9-mkFramework\mkframework_v4_125_3_r306\lib\framework\abstract\abstract_row.php (71)
    abstract_model -> insert( )
    #5 C:\xampp\htdocs\9-mkFramework\mkframework_v4_125_3_r306\lib\framework\abstract\abstract_row.php (56)
    abstract_row -> insert( )
    #6 C:\xampp\htdocs\9-mkFramework\mkframework_v4_125_3_r306\data\genere\PRESTATIONS_ESPECES\model\model_prn.php (68)
    abstract_row -> save( )
    #7 C:\xampp\htdocs\9-mkFramework\mkframework_v4_125_3_r306\data\genere\PRESTATIONS_ESPECES\module\saisir\main.php (346)
    row_prn -> save( )
    #8 C:\xampp\htdocs\9-mkFramework\mkframework_v4_125_3_r306\data\genere\PRESTATIONS_ESPECES\module\saisir\main.php (127)
    module_saisir -> processSave( )
    #9 C:\xampp\htdocs\9-mkFramework\mkframework_v4_125_3_r306\lib\framework\class_root.php (263)
    module_saisir -> _new( )
    #10 C:\xampp\htdocs\9-mkFramework\mkframework_v4_125_3_r306\data\genere\PRESTATIONS_ESPECES\public\index.php (47)
    _root -> run( )
    #11 {main}

    Fichier : C:\xampp\htdocs\9-mkFramework\mkframework_v4_125_3_r306\lib\framework\abstract\abstract_sgbd_pdo.php ligne 251

    Message : PDOStatement::execute(): SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`prestations_especes`.`prn`, CONSTRAINT `prn_ibfk_1` FOREIGN KEY (`prn_id`) REFERENCES `saisir` (`saisir_prn_id`) ON DELETE CASCADE ON UPDATE CASCADE)
      0  0

  2. #2
    Membre habitué
    fin
    J'ai trouvé la solution !!!!

  3. #3
    Rédacteur

    Quel était le problème de violation de FK ? suppression d'une enregistrement lié ?
    Framework php sécurisé et simple à prendre en main avec générateur web http://mkframework.com/ (hebergé sur developpez.com)
    Mes cours/tutoriaux

  4. #4
    Membre habitué
    reponse
    Dans ma table saisir contenant les clés étrangères, la méthode new insérait 0 au lieu des id des tables liés.

    Je pense que si le framework proposait comme pour la gestion des droits une gestion des dates ce serait sympa.
    Cela faciliterait l'extraction de statistiques sur les données.

    Qu'en penses tu?

  5. #5
    Rédacteur

    Le problème de la gestion de dates, c'est qu'elle dépend du sgbd utilisé, beaucoup de différences entre mysql, sql server, oracle and co
    Framework php sécurisé et simple à prendre en main avec générateur web http://mkframework.com/ (hebergé sur developpez.com)
    Mes cours/tutoriaux

###raw>template_hook.ano_emploi###