5 * Copyright (c) 2002-2009, Sebastian Bergmann <sb@sebastian-bergmann.de>.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
15 * * Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
20 * * Neither the name of Sebastian Bergmann nor the names of his
21 * contributors may be used to endorse or promote products derived
22 * from this software without specific prior written permission.
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
28 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
29 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
30 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
34 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
39 * @author Sebastian Bergmann <sb@sebastian-bergmann.de>
40 * @copyright 2002-2009 Sebastian Bergmann <sb@sebastian-bergmann.de>
41 * @license http://www.opensource.org/licenses/bsd-license.php BSD License
43 * @link http://www.phpunit.de/
44 * @since File available since Release 3.1.4
47 require_once 'PHPUnit/Framework.php';
48 require_once 'PHPUnit/Util/Metrics/Project.php';
49 require_once 'PHPUnit/Util/Class.php';
50 require_once 'PHPUnit/Util/CodeCoverage.php';
51 require_once 'PHPUnit/Util/Filesystem.php';
52 require_once 'PHPUnit/Util/Filter.php';
54 PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');
61 * @author Sebastian Bergmann <sb@sebastian-bergmann.de>
62 * @copyright 2002-2009 Sebastian Bergmann <sb@sebastian-bergmann.de>
63 * @license http://www.opensource.org/licenses/bsd-license.php BSD License
64 * @version Release: 3.3.17
65 * @link http://www.phpunit.de/
66 * @since Class available since Release 3.1.4
68 class PHPUnit_Util_Log_CodeCoverage_Database
79 * @throws PDOException
81 public function __construct(PDO $dbh)
87 * Stores code coverage information.
89 * @param PHPUnit_Framework_TestResult $result
90 * @param integer $runId
91 * @param integer $revision
92 * @param string $commonPath
94 public function storeCodeCoverage(PHPUnit_Framework_TestResult $result, $runId, $revision, $commonPath = '')
96 $codeCoverage = $result->getCodeCoverageInformation(FALSE);
97 $summary = PHPUnit_Util_CodeCoverage::getSummary($codeCoverage);
98 $files = array_keys($summary);
99 $projectMetrics = new PHPUnit_Util_Metrics_Project($files, $summary);
100 $storedClasses = array();
102 if (empty($commonPath)) {
103 $commonPath = PHPUnit_Util_Filesystem::getCommonPath($files);
106 $this->dbh->beginTransaction();
108 foreach ($files as $file) {
109 $filename = str_replace($commonPath, '', $file);
111 $fileMetrics = $projectMetrics->getFile($file);
112 $lines = $fileMetrics->getLines();
113 $hash = md5_file($file);
115 $stmt = $this->dbh->prepare(
118 WHERE code_file_name = :filename
119 AND revision = :revision;'
122 $stmt->bindParam(':filename', $filename, PDO::PARAM_STR);
123 $stmt->bindParam(':revision', $revision, PDO::PARAM_INT);
127 $fileId = (int)$stmt->fetchColumn();
133 $stmt = $this->dbh->prepare(
134 'INSERT INTO code_file
135 (code_file_name, code_file_md5, revision)
136 VALUES(:filename, :hash, :revision);'
139 $stmt->bindParam(':filename', $filename, PDO::PARAM_STR);
140 $stmt->bindParam(':hash', $hash, PDO::PARAM_STR);
141 $stmt->bindParam(':revision', $revision, PDO::PARAM_INT);
144 $fileId = $this->dbh->lastInsertId();
146 $stmt = $this->dbh->prepare(
147 'INSERT INTO code_class
148 (code_file_id, code_class_name,
149 code_class_start_line, code_class_end_line)
150 VALUES(:fileId, :className, :startLine, :endLine);'
153 foreach ($fileMetrics->getClasses() as $classMetrics) {
154 $className = $classMetrics->getClass()->getName();
155 $classStartLine = $classMetrics->getClass()->getStartLine();
156 $classEndLine = $classMetrics->getClass()->getEndLine();
158 $stmt->bindParam(':fileId', $fileId, PDO::PARAM_INT);
159 $stmt->bindParam(':className', $className, PDO::PARAM_STR);
160 $stmt->bindParam(':startLine', $classStartLine, PDO::PARAM_INT);
161 $stmt->bindParam(':endLine', $classEndLine, PDO::PARAM_INT);
164 $classId = $this->dbh->lastInsertId();
165 $storedClasses[$className] = $classId;
167 $stmt2 = $this->dbh->prepare(
168 'INSERT INTO code_method
169 (code_class_id, code_method_name,
170 code_method_start_line, code_method_end_line)
171 VALUES(:classId, :methodName, :startLine, :endLine);'
174 foreach ($classMetrics->getMethods() as $methodMetrics) {
175 $methodName = $methodMetrics->getMethod()->getName();
176 $methodStartLine = $methodMetrics->getMethod()->getStartLine();
177 $methodEndLine = $methodMetrics->getMethod()->getEndLine();
179 $stmt2->bindParam(':classId', $classId, PDO::PARAM_INT);
180 $stmt2->bindParam(':methodName', $methodName, PDO::PARAM_STR);
181 $stmt2->bindParam(':startLine', $methodStartLine, PDO::PARAM_INT);
182 $stmt2->bindParam(':endLine', $methodEndLine, PDO::PARAM_INT);
189 $stmt = $this->dbh->prepare(
190 'INSERT INTO code_line
191 (code_file_id, code_line_number, code_line,
193 VALUES(:fileId, :lineNumber, :line, :covered);'
198 foreach ($lines as $line) {
201 if (isset($summary[$file][$i])) {
202 if (is_int($summary[$file][$i])) {
203 $covered = $summary[$file][$i];
209 $stmt->bindParam(':fileId', $fileId, PDO::PARAM_INT);
210 $stmt->bindParam(':lineNumber', $i, PDO::PARAM_INT);
211 $stmt->bindParam(':line', $line, PDO::PARAM_STR);
212 $stmt->bindParam(':covered', $covered, PDO::PARAM_INT);
219 $stmt = $this->dbh->prepare(
220 'INSERT INTO metrics_file
221 (run_id, code_file_id, metrics_file_coverage,
222 metrics_file_loc, metrics_file_cloc, metrics_file_ncloc,
223 metrics_file_loc_executable, metrics_file_loc_executed)
224 VALUES(:runId, :fileId, :coverage, :loc, :cloc, :ncloc,
225 :locExecutable, :locExecuted);'
228 $fileCoverage = $fileMetrics->getCoverage();
229 $fileLoc = $fileMetrics->getLoc();
230 $fileCloc = $fileMetrics->getCloc();
231 $fileNcloc = $fileMetrics->getNcloc();
232 $fileLocExecutable = $fileMetrics->getLocExecutable();
233 $fileLocExecuted = $fileMetrics->getLocExecuted();
235 $stmt->bindParam(':runId', $runId, PDO::PARAM_INT);
236 $stmt->bindParam(':fileId', $fileId, PDO::PARAM_INT);
237 $stmt->bindParam(':coverage', $fileCoverage);
238 $stmt->bindParam(':loc', $fileLoc, PDO::PARAM_INT);
239 $stmt->bindParam(':cloc', $fileCloc, PDO::PARAM_INT);
240 $stmt->bindParam(':ncloc', $fileNcloc, PDO::PARAM_INT);
241 $stmt->bindParam(':locExecutable', $fileLocExecutable, PDO::PARAM_INT);
242 $stmt->bindParam(':locExecuted', $fileLocExecuted, PDO::PARAM_INT);
245 $stmtSelectFunctionId = $this->dbh->prepare(
246 'SELECT code_function_id
247 FROM code_file, code_function
248 WHERE code_function.code_file_id = code_file.code_file_id
249 AND code_file.revision = :revision
250 AND code_function.code_function_name = :functionName;'
253 $stmtInsertFunction = $this->dbh->prepare(
254 'INSERT INTO metrics_function
255 (run_id, code_function_id, metrics_function_coverage,
256 metrics_function_loc, metrics_function_loc_executable, metrics_function_loc_executed,
257 metrics_function_ccn, metrics_function_crap, metrics_function_npath)
258 VALUES(:runId, :functionId, :coverage, :loc,
259 :locExecutable, :locExecuted, :ccn, :crap, :npath);'
262 $stmtSelectClassId = $this->dbh->prepare(
263 'SELECT code_class_id
264 FROM code_file, code_class
265 WHERE code_class.code_file_id = code_file.code_file_id
266 AND code_file.revision = :revision
267 AND code_class.code_class_name = :className;'
270 $stmtInsertClass = $this->dbh->prepare(
271 'INSERT INTO metrics_class
272 (run_id, code_class_id, metrics_class_coverage,
273 metrics_class_loc, metrics_class_loc_executable, metrics_class_loc_executed,
274 metrics_class_aif, metrics_class_ahf,
275 metrics_class_cis, metrics_class_csz, metrics_class_dit,
276 metrics_class_impl, metrics_class_mif, metrics_class_mhf,
277 metrics_class_noc, metrics_class_pf, metrics_class_vars,
278 metrics_class_varsnp, metrics_class_varsi,
279 metrics_class_wmc, metrics_class_wmcnp, metrics_class_wmci)
280 VALUES(:runId, :classId, :coverage, :loc, :locExecutable,
281 :locExecuted, :aif, :ahf, :cis, :csz, :dit, :impl,
282 :mif, :mhf, :noc, :pf, :vars, :varsnp, :varsi,
283 :wmc, :wmcnp, :wmci);'
286 $stmtSelectMethodId = $this->dbh->prepare(
287 'SELECT code_method_id
288 FROM code_file, code_class, code_method
289 WHERE code_class.code_file_id = code_file.code_file_id
290 AND code_class.code_class_id = code_method.code_class_id
291 AND code_file.revision = :revision
292 AND code_class.code_class_name = :className
293 AND code_method.code_method_name = :methodName;'
296 $stmtInsertMethod = $this->dbh->prepare(
297 'INSERT INTO metrics_method
298 (run_id, code_method_id, metrics_method_coverage,
299 metrics_method_loc, metrics_method_loc_executable, metrics_method_loc_executed,
300 metrics_method_ccn, metrics_method_crap, metrics_method_npath)
301 VALUES(:runId, :methodId, :coverage, :loc,
302 :locExecutable, :locExecuted, :ccn, :crap, :npath);'
305 foreach ($fileMetrics->getFunctions() as $functionMetrics) {
306 $functionName = $functionMetrics->getFunction()->getName();
308 $stmtSelectFunctionId->bindParam(':functionName', $functionName, PDO::PARAM_STR);
309 $stmtSelectFunctionId->bindParam(':revision', $revision, PDO::PARAM_INT);
310 $stmtSelectFunctionId->execute();
312 $functionId = (int)$stmtSelectFunctionId->fetchColumn();
313 $stmtSelectFunctionId->closeCursor();
315 $functionCoverage = $functionMetrics->getCoverage();
316 $functionLoc = $functionMetrics->getLoc();
317 $functionLocExecutable = $functionMetrics->getLocExecutable();
318 $functionLocExecuted = $functionMetrics->getLocExecuted();
319 $functionCcn = $functionMetrics->getCCN();
320 $functionCrap = $functionMetrics->getCrapIndex();
321 $functionNpath = $functionMetrics->getNPath();
323 $stmtInsertFunction->bindParam(':runId', $runId, PDO::PARAM_INT);
324 $stmtInsertFunction->bindParam(':functionId', $functionId, PDO::PARAM_INT);
325 $stmtInsertFunction->bindParam(':coverage', $functionCoverage);
326 $stmtInsertFunction->bindParam(':loc', $functionLoc, PDO::PARAM_INT);
327 $stmtInsertFunction->bindParam(':locExecutable', $functionLocExecutable, PDO::PARAM_INT);
328 $stmtInsertFunction->bindParam(':locExecuted', $functionLocExecuted, PDO::PARAM_INT);
329 $stmtInsertFunction->bindParam(':ccn', $functionCcn, PDO::PARAM_INT);
330 $stmtInsertFunction->bindParam(':crap', $functionCrap);
331 $stmtInsertFunction->bindParam(':npath', $functionNpath, PDO::PARAM_INT);
332 $stmtInsertFunction->execute();
335 foreach ($fileMetrics->getClasses() as $classMetrics) {
336 $className = $classMetrics->getClass()->getName();
338 $stmtSelectClassId->bindParam(':className', $className, PDO::PARAM_STR);
339 $stmtSelectClassId->bindParam(':revision', $revision, PDO::PARAM_INT);
340 $stmtSelectClassId->execute();
342 $classId = (int)$stmtSelectClassId->fetchColumn();
343 $stmtSelectClassId->closeCursor();
345 $classCoverage = $classMetrics->getCoverage();
346 $classLoc = $classMetrics->getLoc();
347 $classLocExecutable = $classMetrics->getLocExecutable();
348 $classLocExecuted = $classMetrics->getLocExecuted();
349 $classAif = $classMetrics->getAIF();
350 $classAhf = $classMetrics->getAHF();
351 $classCis = $classMetrics->getCIS();
352 $classCsz = $classMetrics->getCSZ();
353 $classDit = $classMetrics->getDIT();
354 $classImpl = $classMetrics->getIMPL();
355 $classMif = $classMetrics->getMIF();
356 $classMhf = $classMetrics->getMHF();
357 $classNoc = $classMetrics->getNOC();
358 $classPf = $classMetrics->getPF();
359 $classVars = $classMetrics->getVARS();
360 $classVarsnp = $classMetrics->getVARSnp();
361 $classVarsi = $classMetrics->getVARSi();
362 $classWmc = $classMetrics->getWMC();
363 $classWmcnp = $classMetrics->getWMCnp();
364 $classWmci = $classMetrics->getWMCi();
366 $stmtInsertClass->bindParam(':runId', $runId, PDO::PARAM_INT);
367 $stmtInsertClass->bindParam(':classId', $classId, PDO::PARAM_INT);
368 $stmtInsertClass->bindParam(':coverage', $classCoverage);
369 $stmtInsertClass->bindParam(':loc', $classLoc, PDO::PARAM_INT);
370 $stmtInsertClass->bindParam(':locExecutable', $classLocExecutable, PDO::PARAM_INT);
371 $stmtInsertClass->bindParam(':locExecuted', $classLocExecuted, PDO::PARAM_INT);
372 $stmtInsertClass->bindParam(':aif', $classAif);
373 $stmtInsertClass->bindParam(':ahf', $classAhf);
374 $stmtInsertClass->bindParam(':cis', $classCis, PDO::PARAM_INT);
375 $stmtInsertClass->bindParam(':csz', $classCsz, PDO::PARAM_INT);
376 $stmtInsertClass->bindParam(':dit', $classDit, PDO::PARAM_INT);
377 $stmtInsertClass->bindParam(':impl', $classImpl, PDO::PARAM_INT);
378 $stmtInsertClass->bindParam(':mif', $classMif);
379 $stmtInsertClass->bindParam(':mhf', $classMhf);
380 $stmtInsertClass->bindParam(':noc', $classNoc, PDO::PARAM_INT);
381 $stmtInsertClass->bindParam(':pf', $classPf);
382 $stmtInsertClass->bindParam(':vars', $classVars, PDO::PARAM_INT);
383 $stmtInsertClass->bindParam(':varsnp', $classVarsnp, PDO::PARAM_INT);
384 $stmtInsertClass->bindParam(':varsi', $classVarsi, PDO::PARAM_INT);
385 $stmtInsertClass->bindParam(':wmc', $classWmc, PDO::PARAM_INT);
386 $stmtInsertClass->bindParam(':wmcnp', $classWmcnp, PDO::PARAM_INT);
387 $stmtInsertClass->bindParam(':wmci', $classWmci, PDO::PARAM_INT);
388 $stmtInsertClass->execute();
390 foreach ($classMetrics->getMethods() as $methodMetrics) {
391 $methodName = $methodMetrics->getMethod()->getName();
393 $stmtSelectMethodId->bindParam(':className', $className, PDO::PARAM_STR);
394 $stmtSelectMethodId->bindParam(':methodName', $methodName, PDO::PARAM_STR);
395 $stmtSelectMethodId->bindParam(':revision', $revision, PDO::PARAM_INT);
396 $stmtSelectMethodId->execute();
398 $methodId = (int)$stmtSelectMethodId->fetchColumn();
399 $stmtSelectMethodId->closeCursor();
401 $methodCoverage = $methodMetrics->getCoverage();
402 $methodLoc = $methodMetrics->getLoc();
403 $methodLocExecutable = $methodMetrics->getLocExecutable();
404 $methodLocExecuted = $methodMetrics->getLocExecuted();
405 $methodCcn = $methodMetrics->getCCN();
406 $methodCrap = $methodMetrics->getCrapIndex();
407 $methodNpath = $methodMetrics->getNPath();
409 $stmtInsertMethod->bindParam(':runId', $runId, PDO::PARAM_INT);
410 $stmtInsertMethod->bindParam(':methodId', $methodId, PDO::PARAM_INT);
411 $stmtInsertMethod->bindParam(':coverage', $methodCoverage);
412 $stmtInsertMethod->bindParam(':loc', $methodLoc, PDO::PARAM_INT);
413 $stmtInsertMethod->bindParam(':locExecutable', $methodLocExecutable, PDO::PARAM_INT);
414 $stmtInsertMethod->bindParam(':locExecuted', $methodLocExecuted, PDO::PARAM_INT);
415 $stmtInsertMethod->bindParam(':ccn', $methodCcn, PDO::PARAM_INT);
416 $stmtInsertMethod->bindParam(':crap', $methodCrap);
417 $stmtInsertMethod->bindParam(':npath', $methodNpath, PDO::PARAM_INT);
418 $stmtInsertMethod->execute();
422 unset($stmtSelectFunctionId);
423 unset($stmtInsertFunction);
424 unset($stmtSelectClassId);
425 unset($stmtInsertClass);
426 unset($stmtSelectMethodId);
427 unset($stmtInsertMethod);
429 $stmt = $this->dbh->prepare(
430 'SELECT code_line_id, code_line_covered
432 WHERE code_file_id = :fileId
433 AND code_line_number = :lineNumber;'
436 $stmt2 = $this->dbh->prepare(
438 SET code_line_covered = :lineCovered
439 WHERE code_line_id = :lineId;'
442 $stmt3 = $this->dbh->prepare(
443 'INSERT INTO code_coverage
444 (test_id, code_line_id)
445 VALUES(:testId, :lineId);'
448 for ($lineNumber = 1; $lineNumber <= $fileLoc; $lineNumber++) {
449 $coveringTests = PHPUnit_Util_CodeCoverage::getCoveringTests(
450 $codeCoverage, $file, $lineNumber
453 if (is_array($coveringTests)) {
454 $stmt->bindParam(':fileId', $fileId, PDO::PARAM_INT);
455 $stmt->bindParam(':lineNumber', $lineNumber, PDO::PARAM_INT);
458 $codeLineId = (int)$stmt->fetchColumn(0);
459 $oldCoverageFlag = (int)$stmt->fetchColumn(1);
460 $newCoverageFlag = isset($summary[$file][$lineNumber]) ? 1 : 0;
462 if (($oldCoverageFlag == 0 && $newCoverageFlag != 0) ||
463 ($oldCoverageFlag < 0 && $newCoverageFlag > 0)) {
464 $stmt2->bindParam(':lineCovered', $newCoverageFlag, PDO::PARAM_INT);
465 $stmt2->bindParam(':lineId', $codeLineId, PDO::PARAM_INT);
469 foreach ($coveringTests as $test) {
470 $stmt3->bindParam(':testId', $test->__db_id, PDO::PARAM_INT);
471 $stmt3->bindParam(':lineId', $codeLineId, PDO::PARAM_INT);
482 $stmt = $this->dbh->prepare(
483 'SELECT code_method.code_method_id
484 FROM code_class, code_method
485 WHERE code_class.code_class_id = code_method.code_class_id
486 AND code_class.code_class_name = :className
487 AND code_method.code_method_name = :methodName;'
490 $stmt2 = $this->dbh->prepare(
492 SET code_method_id = :methodId
493 WHERE test_id = :testId;'
496 foreach ($result->topTestSuite() as $test) {
497 if ($test instanceof PHPUnit_Framework_TestCase) {
498 $className = get_class($test);
499 $methodName = $test->getName();
501 $stmt->bindParam(':className', $className, PDO::PARAM_STR);
502 $stmt->bindParam(':methodName', $methodName, PDO::PARAM_STR);
505 $methodId = (int)$stmt->fetchColumn();
506 $stmt->closeCursor();
508 $stmt2->bindParam(':methodId', $methodId, PDO::PARAM_INT);
509 $stmt2->bindParam(':testId', $test->__db_id, PDO::PARAM_INT);
517 $stmt = $this->dbh->prepare(
518 'INSERT INTO metrics_project
519 (run_id, metrics_project_cls, metrics_project_clsa,
520 metrics_project_clsc, metrics_project_roots,
521 metrics_project_leafs, metrics_project_interfs,
522 metrics_project_maxdit)
523 VALUES(:runId, :cls, :clsa, :clsc, :roots, :leafs,
527 $cls = $projectMetrics->getCLS();
528 $clsa = $projectMetrics->getCLSa();
529 $clsc = $projectMetrics->getCLSc();
530 $interfs = $projectMetrics->getInterfs();
531 $roots = $projectMetrics->getRoots();
532 $leafs = $projectMetrics->getLeafs();
533 $maxDit = $projectMetrics->getMaxDit();
535 $stmt->bindParam(':runId', $runId, PDO::PARAM_INT);
536 $stmt->bindParam(':cls', $cls, PDO::PARAM_INT);
537 $stmt->bindParam(':clsa', $clsa, PDO::PARAM_INT);
538 $stmt->bindParam(':clsc', $clsc, PDO::PARAM_INT);
539 $stmt->bindParam(':roots', $roots, PDO::PARAM_INT);
540 $stmt->bindParam(':leafs', $leafs, PDO::PARAM_INT);
541 $stmt->bindParam(':interfs', $interfs, PDO::PARAM_INT);
542 $stmt->bindParam(':maxdit', $maxDit, PDO::PARAM_INT);
547 $stmt = $this->dbh->prepare(
549 SET code_class_parent_id = :parentClassId
550 WHERE code_class_id = :classId;'
553 $stmt2 = $this->dbh->prepare(
554 'SELECT code_class.code_class_id as code_class_id
555 FROM code_class, code_file
556 WHERE code_class.code_file_id = code_file.code_file_id
557 AND code_file.revision = :revision
558 AND code_class.code_class_name = :parentClassName;'
561 foreach ($storedClasses as $className => $classId) {
562 $class = new ReflectionClass($className);
563 $parentClass = $class->getParentClass();
565 if ($parentClass !== FALSE) {
566 $parentClassName = $parentClass->getName();
569 if (isset($storedClasses[$parentClassName])) {
570 $parentClassId = $storedClasses[$parentClassName];
572 $stmt2->bindParam(':parentClassName', $parentClassName, PDO::PARAM_STR);
573 $stmt2->bindParam(':revision', $revision, PDO::PARAM_INT);
576 $parentClassId = (int)$stmt2->fetchColumn();
577 $stmt2->closeCursor();
580 if ($parentClassId > 0) {
581 $stmt->bindParam(':classId', $classId, PDO::PARAM_INT);
582 $stmt->bindParam(':parentClassId', $parentClassId, PDO::PARAM_INT);
591 $this->dbh->commit();