CDbException

CDbCommand nemohl vykonat SQL příkaz: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`6925-knauf_point`.`sistemconfigurat`, CONSTRAINT `sistemconfigurat_ibfk_2` FOREIGN KEY (`id_sistem`) REFERENCES `sistem` (`id`) ON DELETE CASCADE ON UPDATE CASCADE). The SQL statement executed was: INSERT INTO `sistemconfigurat` (`suprafata`, `grosime`, `id_sistem`) VALUES (:yp0, :yp1, :yp2)

/data/www/domeny/knaufpoint.cz/www/framework/db/CDbCommand.php(354)

342             return $n;
343         }
344         catch(Exception $e)
345         {
346             if($this->_connection->enableProfiling)
347                 Yii::endProfile('system.db.CDbCommand.execute('.$this->getText().$par.')','system.db.CDbCommand.execute');
348             $errorInfo = $e instanceof PDOException ? $e->errorInfo : null;
349             $message = $e->getMessage();
350             Yii::log(Yii::t('yii','CDbCommand::execute() failed: {error}. The SQL statement executed was: {sql}.',
351                 array('{error}'=>$message, '{sql}'=>$this->getText().$par)),CLogger::LEVEL_ERROR,'system.db.CDbCommand');
352             if(YII_DEBUG)
353                 $message .= '. The SQL statement executed was: '.$this->getText().$par;
354             throw new CDbException(Yii::t('yii','CDbCommand failed to execute the SQL statement: {error}',
355                 array('{error}'=>$message)),(int)$e->getCode(),$errorInfo);
356         }
357     }
358 
359     /**
360      * Executes the SQL statement and returns query result.
361      * This method is for executing an SQL query that returns result set.
362      * @param array $params input parameters (name=>value) for the SQL execution. This is an alternative
363      * to {@link bindParam} and {@link bindValue}. If you have multiple input parameters, passing
364      * them in this way can improve the performance. Note that if you pass parameters in this way,
365      * you cannot bind parameters or values using {@link bindParam} or {@link bindValue}, and vice versa.
366      * binding methods and  the input parameters this way can improve the performance.

Stack Trace

#2
+
 /data/www/domeny/knaufpoint.cz/www/protected/models/Lucrare.php(147): CActiveRecord->save()
142             $sisteme[] = $sistem;
143         }
144         
145         $sistemconfigurat = new Sistemconfigurat('create');
146         $sistemconfigurat->initfrom( $sistem_id );
147         if ( !$sistemconfigurat->save() ){
148             print_r($sistemconfigurat->getErrors());
149         }
150         
151         $sisteme[] = $sistemconfigurat;
152         
#3
+
 /data/www/domeny/knaufpoint.cz/www/protected/controllers/SiteController.php(431): Lucrare->adauga_sistem("45")
426     }
427 
428     public function event_adaugaSistem() {
429         $this->setup_lucrare();
430 
431         $this->lucrare->adauga_sistem($_GET['id_sistem']);
432         $this->lucrare->save();
433     }
434 
435     public function event_adaugaCatalog() {
436         $this->setup_lucrare();
#4
+
 /data/www/domeny/knaufpoint.cz/www/protected/controllers/SiteController.php(212): SiteController->event_adaugaSistem()
207             }
208         }
209 
210         if (isset($_GET['event']) && in_array($_GET['event'], $this->events)) {
211             $method = 'event_' . $_GET['event'];
212             $this->$method();
213 
214             $redirOptions = ['lucrare', 'id_lucrare' => $this->lucrare->id];
215             if (isset($_GET['switchToTab'])) {
216                 $redirOptions['switchToTab'] = $_GET['switchToTab'];
217             }
2024-03-28 23:32:51 Apache Yii Framework/1.1.12