coveragereport
This commit is contained in:
parent
11ee3cf9ad
commit
7efe3f5c3a
301
tests/cc.php
301
tests/cc.php
@ -1,301 +0,0 @@
|
||||
<?php
|
||||
/*
|
||||
* $Id: Doctrine.php 1976 2007-07-11 22:03:47Z zYne $
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information, see
|
||||
* <http://www.phpdoctrine.com>.
|
||||
*/
|
||||
|
||||
require_once dirname(__FILE__) . '/../lib/Doctrine.php';
|
||||
spl_autoload_register(array('Doctrine', 'autoload'));
|
||||
|
||||
$reporter = new Doctrine_Coverage_Report("coverage.txt");
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
.covered{ background: green;}
|
||||
.normal{ background: white;}
|
||||
.red{ background: red;}
|
||||
.orange{ background: #f90;}
|
||||
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
|
||||
if (isset($_GET["file"])){
|
||||
echo '<h1>Coverage for ' . $_GET["file"] . '</h1>';
|
||||
echo '<a href="cc.php">Back to coverage report</a>';
|
||||
echo "<br>detailed view down atm <br> Will be up later on<br>";
|
||||
|
||||
|
||||
// $reporter->showFile($_GET["file"]);
|
||||
} else {
|
||||
?>
|
||||
<h1>Coverage report for Doctrine</h1>
|
||||
<p>Default mode shows results sorted by percentage. This can be changed with GET variables:<br /> <ul><li>order = covered|total|maybe|notcovered|percentage</li><li>desc=true</li></ul></p>
|
||||
<table>
|
||||
<tr><th></th><th>Percentage</th><th>Total</th><th>Covered</th><th>Maybe</th><th>Not Covered</th><th></th></tr>
|
||||
<?php
|
||||
$reporter->showSummary();
|
||||
echo "</table>";
|
||||
}
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* Doctrine
|
||||
* the base class of Doctrine framework
|
||||
*
|
||||
* @package Doctrine
|
||||
* @author Bjarte S. Karlsen <bjartka@pvv.ntnu.no>
|
||||
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
|
||||
* @category Object Relational Mapping
|
||||
* @link www.phpdoctrine.com
|
||||
* @since 1.0
|
||||
* @version $Revision: 1976 $
|
||||
*/
|
||||
class Doctrine_Coverage_Report
|
||||
{
|
||||
|
||||
const COVERED = 1;
|
||||
const MAYBE = -2;
|
||||
const NOTCOVERED = -1;
|
||||
|
||||
private $path;
|
||||
private $coverage;
|
||||
private $key;
|
||||
private $covered;
|
||||
private $totallines = 0;
|
||||
private $totalcovered = 0;
|
||||
private $totalmaybe = 0;
|
||||
private $totalnotcovered = 0;
|
||||
|
||||
/*
|
||||
* Create a new coverage report
|
||||
*
|
||||
* @param string $file The name of the file where coverage data is stored
|
||||
*
|
||||
*/
|
||||
public function __construct($file)
|
||||
{
|
||||
$result = unserialize(file_get_contents("coverage.txt"));
|
||||
$this->path = $result["path"];
|
||||
$this->coverage = $result["coverage"];
|
||||
|
||||
$this->sortBy ="percentage"; // default sort
|
||||
}
|
||||
|
||||
/*
|
||||
* Show graphical coverage report for a file
|
||||
*
|
||||
* @param string $fileName The name of the file to show
|
||||
*/
|
||||
public function showFile($fileName)
|
||||
{
|
||||
$key = $this->path . $fileName;
|
||||
$html = '<div id="coverage">';
|
||||
if ( ! isset( $this->coverage[$key]))
|
||||
{
|
||||
echo '<h2>This file has not been tested!</h2>';
|
||||
}
|
||||
$coveredLines = $this->coverage[$key];
|
||||
$fileArray = file(Doctrine::getPath() . "/".$fileName);
|
||||
$html .= '<table>' . "\n";
|
||||
foreach ($fileArray as $num => $line){
|
||||
$linenum = $num+1;
|
||||
$html .= '<tr><td>' . $linenum . '</td>' . "\n";
|
||||
$class ="normal";
|
||||
if (isset($coveredLines[$linenum]) && $coveredLines[$linenum] == 1){
|
||||
$class = "covered";
|
||||
} else if (isset($coveredLines[$linenum]) && $coveredLines[$linenum] == -1) {
|
||||
$class ="red";
|
||||
} else if (isset($coveredLines[$linenum]) && $coveredLines[$linenum] == -2) {
|
||||
$class ="orange";
|
||||
}
|
||||
|
||||
$line = str_replace(" ", " ", htmlspecialchars($line));
|
||||
$html .= '<td class="' . $class . '">' . $line . '</td></tr>' . "\n";
|
||||
}
|
||||
$html .='</table></div>';
|
||||
echo $html;
|
||||
}
|
||||
|
||||
/*
|
||||
* Generate coverage data for non tested files
|
||||
*
|
||||
* Scans all files and records data for those that are not in the coverage
|
||||
* record.
|
||||
*
|
||||
* @return array An array with coverage data
|
||||
*/
|
||||
public function generateNotCoveredFiles()
|
||||
{
|
||||
$it = new RecursiveDirectoryIterator(Doctrine::getPath());
|
||||
|
||||
$notCoveredArray = array();
|
||||
foreach (new RecursiveIteratorIterator($it) as $file){
|
||||
if (strpos($file->getPathname(), ".svn")){
|
||||
continue;
|
||||
}
|
||||
$path = Doctrine::getPath() . DIRECTORY_SEPARATOR;
|
||||
$coveredPath = str_replace($path, $this->path, $file->getPathname());
|
||||
if (isset($this->coverage[$coveredPath])){
|
||||
continue;
|
||||
}
|
||||
|
||||
$class = str_replace($path, "", $file->getPathname());
|
||||
$class = str_replace(DIRECTORY_SEPARATOR, "_", $class);
|
||||
$class = substr($class, 0,-4);
|
||||
if (strpos($class, '_Interface')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( ! class_exists($class)){
|
||||
continue;
|
||||
}
|
||||
|
||||
try{
|
||||
$refClass = new ReflectionClass($class);
|
||||
} catch (Exception $e){
|
||||
echo $e->getMessage();
|
||||
continue;
|
||||
}
|
||||
$lines = 0;
|
||||
$methodLines = 0;
|
||||
foreach ($refClass->getMethods() as $refMethod){
|
||||
|
||||
if ($refMethod->getDeclaringClass() != $refClass){
|
||||
continue;
|
||||
}
|
||||
$methodLines = $refMethod->getEndLine() - $refMethod->getStartLine();
|
||||
$lines += $methodLines;
|
||||
}
|
||||
if ($methodLines == 0){
|
||||
$notCoveredArray[$class] = array("covered" => 0, "maybe" => 0, "notcovered"=>$lines, "total" => $lines, "percentage" => 100);
|
||||
} else {
|
||||
$notCoveredArray[$class] = array("covered" => 0, "maybe" => 0, "notcovered"=>$lines, "total" => $lines, "percentage" => 0);
|
||||
}
|
||||
$this->totallines += $lines;
|
||||
$this->totalnotcovered += $lines;
|
||||
}
|
||||
return $notCoveredArray;
|
||||
}
|
||||
|
||||
/*
|
||||
* Show a summary of all files in Doctrine and their coverage data
|
||||
*
|
||||
* @uses generateNonCoveredFiles
|
||||
* @uses generateCoverage
|
||||
*/
|
||||
public function showSummary()
|
||||
{
|
||||
if (isset($_GET["order"])){
|
||||
$this->sortBy = $_GET["order"];
|
||||
}
|
||||
$coveredArray = $this->generateCoverage();
|
||||
$notcoveredArray = $this->generateNotCoveredFiles();
|
||||
$coveredArray = array_merge($coveredArray, $notcoveredArray);
|
||||
|
||||
//lets sort it.
|
||||
uasort($coveredArray, array($this,"sortArray"));
|
||||
|
||||
//and flip if it perhaps?
|
||||
if (isset($_GET["desc"]) && $_GET["desc"] == "true"){
|
||||
$coveredArray = array_reverse($coveredArray, true);
|
||||
}
|
||||
|
||||
//ugly code to print out the result:
|
||||
echo "<tr><td>" . TOTAL . "</td><td>" . round((($this->totalcovered + $this->totalmaybe) / $this->totallines) * 100, 2) . " % </td><td>$this->totallines</td><td>$this->totalcovered</td><td>$this->totalmaybe</td><td>$this->totalnotcovered</td><td></td></tr>";
|
||||
foreach($coveredArray as $class => $info){
|
||||
$fileName = str_replace("_", "/", $class) . ".php";
|
||||
echo "<tr><td>" . $class . "</td><td>" . $info["percentage"] . " % </td><td>" . $info["total"] . "</td><td>" . $info["covered"] . "</td><td>" . $info["maybe"] . "</td><td>" . $info["notcovered"]. "</td><td><a href=\"cc.php?file=" . $fileName . "\">coverage</a></td></tr>";
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Generate coverage data for tested files
|
||||
*
|
||||
*@return array An array of coverage data
|
||||
*/
|
||||
public function generateCoverage()
|
||||
{
|
||||
$coveredArray = array();
|
||||
foreach ($this->coverage as $file => $lines) {
|
||||
$pos = strpos($file, $this->path);
|
||||
if ($pos === false && $pos !== 0){
|
||||
continue;
|
||||
}
|
||||
|
||||
$class = str_replace(DIRECTORY_SEPARATOR, '_', substr($file, strlen($this->path), -4));
|
||||
$class = str_replace($this->path, Doctrine::getPath(), $class);
|
||||
if (strpos($class, '_Interface')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( ! class_exists($class)){
|
||||
continue;
|
||||
}
|
||||
|
||||
$total = count($lines) -1; //we have to remove one since it always reports the last line as a hit
|
||||
$covered = 0;
|
||||
$maybe = 0;
|
||||
$notcovered = 0;
|
||||
foreach ($lines as $result){
|
||||
switch($result){
|
||||
case self::COVERED:
|
||||
$covered++;
|
||||
break;
|
||||
case self::NOTCOVERED:
|
||||
$notcovered++;
|
||||
break;
|
||||
case self::MAYBE:
|
||||
$maybe++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$covered--; //again we have to remove that last line.
|
||||
$this->totallines += $total;
|
||||
$this->totalcovered += $covered;
|
||||
$this->totalnotcovered += $notcovered;
|
||||
$this->totalmaybe += $maybe;
|
||||
|
||||
if ($total === 0) {
|
||||
$total = 1;
|
||||
}
|
||||
$percentage = round((($covered + $maybe) / $total) * 100, 2);
|
||||
$coveredArray[$class] = array("covered" => $covered, "maybe" => $maybe, "notcovered"=>$notcovered, "total" => $total, "percentage" => $percentage);
|
||||
}
|
||||
return $coveredArray;
|
||||
}
|
||||
|
||||
/*
|
||||
* Uasort function to sort the array by key
|
||||
*
|
||||
*/
|
||||
public function sortArray($a, $b)
|
||||
{
|
||||
if ($a[$this->sortBy] == $b[$this->sortBy]) {
|
||||
return 0;
|
||||
}
|
||||
return ( $a[$this->sortBy] < $b[$this->sortBy]) ? -1 : 1;
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
<td class="normal">/*
|
||||
</td></tr>
|
||||
<tr><td>3</td>
|
||||
<td class="normal"> * $Id: Doctrine.php 3066 2007-11-02 16:07:11Z meus $
|
||||
<td class="normal"> * $Id: Doctrine.php 3092 2007-11-08 19:01:22Z Jonathan.Wage $
|
||||
</td></tr>
|
||||
<tr><td>4</td>
|
||||
<td class="normal"> *
|
||||
@ -103,7 +103,7 @@
|
||||
<td class="normal"> * @since 1.0
|
||||
</td></tr>
|
||||
<tr><td>32</td>
|
||||
<td class="normal"> * @version $Revision: 3066 $
|
||||
<td class="normal"> * @version $Revision: 3092 $
|
||||
</td></tr>
|
||||
<tr><td>33</td>
|
||||
<td class="normal"> */
|
||||
@ -3046,7 +3046,7 @@
|
||||
<td class="normal"> *
|
||||
</td></tr>
|
||||
<tr><td>1013</td>
|
||||
<td class="normal"> * Callback function to classify a classname propperly.
|
||||
<td class="normal"> * Callback function to classify a classname properly.
|
||||
</td></tr>
|
||||
<tr><td>1014</td>
|
||||
<td class="normal"> *
|
||||
@ -3157,27 +3157,24 @@
|
||||
<td class="normal"> {
|
||||
</td></tr>
|
||||
<tr><td>1050</td>
|
||||
<td class="covered"> if (is_dir($path) || is_file($path))
|
||||
<td class="covered"> if (is_dir($path) || is_file($path)) {
|
||||
</td></tr>
|
||||
<tr><td>1051</td>
|
||||
<td class="covered"> {
|
||||
</td></tr>
|
||||
<tr><td>1052</td>
|
||||
<td class="covered"> return true;
|
||||
</td></tr>
|
||||
<tr><td>1053</td>
|
||||
<tr><td>1052</td>
|
||||
<td class="orange"> }
|
||||
</td></tr>
|
||||
<tr><td>1054</td>
|
||||
<tr><td>1053</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1055</td>
|
||||
<tr><td>1054</td>
|
||||
<td class="red"> return mkdir($path, $mode, true);
|
||||
</td></tr>
|
||||
<tr><td>1056</td>
|
||||
<tr><td>1055</td>
|
||||
<td class="orange"> }
|
||||
</td></tr>
|
||||
<tr><td>1057</td>
|
||||
<tr><td>1056</td>
|
||||
<td class="normal">}
|
||||
</td></tr>
|
||||
</table></body></html>
|
File diff suppressed because it is too large
Load Diff
@ -16,7 +16,7 @@
|
||||
<td class="normal">/*
|
||||
</td></tr>
|
||||
<tr><td>3</td>
|
||||
<td class="normal"> * $Id: Mysql.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $
|
||||
<td class="normal"> * $Id: Mysql.php 3084 2007-11-08 14:01:03Z samw3 $
|
||||
</td></tr>
|
||||
<tr><td>4</td>
|
||||
<td class="normal"> *
|
||||
@ -91,7 +91,7 @@
|
||||
<td class="normal"> * @author Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library)
|
||||
</td></tr>
|
||||
<tr><td>28</td>
|
||||
<td class="normal"> * @version $Revision: 2963 $
|
||||
<td class="normal"> * @version $Revision: 3084 $
|
||||
</td></tr>
|
||||
<tr><td>29</td>
|
||||
<td class="normal"> * @link www.phpdoctrine.com
|
||||
@ -1336,7 +1336,7 @@
|
||||
<td class="normal"> public function getIntegerDeclaration($name, $field)
|
||||
</td></tr>
|
||||
<tr><td>443</td>
|
||||
<td class="normal"> {
|
||||
<td class="normal"> {
|
||||
</td></tr>
|
||||
<tr><td>444</td>
|
||||
<td class="covered"> $default = $autoinc = '';
|
||||
@ -1357,53 +1357,65 @@
|
||||
<td class="red"> $field['default'] = empty($field['notnull']) ? null : 0;
|
||||
</td></tr>
|
||||
<tr><td>450</td>
|
||||
<td class="red"> }
|
||||
<td class="red"> }
|
||||
</td></tr>
|
||||
<tr><td>451</td>
|
||||
<td class="red"> $default = ' DEFAULT '.$this->conn->quote($field['default']);
|
||||
<td class="red"> if (is_null($field['default'])) {
|
||||
</td></tr>
|
||||
<tr><td>452</td>
|
||||
<td class="red"> }
|
||||
<td class="red"> $default = ' DEFAULT NULL';
|
||||
</td></tr>
|
||||
<tr><td>453</td>
|
||||
<td class="normal"> /**
|
||||
<td class="red"> } else {
|
||||
</td></tr>
|
||||
<tr><td>454</td>
|
||||
<td class="normal"> elseif (empty($field['notnull'])) {
|
||||
<td class="red"> $default = ' DEFAULT '.$this->conn->quote($field['default']);
|
||||
</td></tr>
|
||||
<tr><td>455</td>
|
||||
<td class="normal"> $default = ' DEFAULT NULL';
|
||||
<td class="normal"> }
|
||||
</td></tr>
|
||||
<tr><td>456</td>
|
||||
<td class="normal"> }
|
||||
<td class="red"> }
|
||||
</td></tr>
|
||||
<tr><td>457</td>
|
||||
<td class="normal"> */
|
||||
<td class="normal"> /**
|
||||
</td></tr>
|
||||
<tr><td>458</td>
|
||||
<td class="normal">
|
||||
<td class="normal"> elseif (empty($field['notnull'])) {
|
||||
</td></tr>
|
||||
<tr><td>459</td>
|
||||
<td class="covered"> $notnull = (isset($field['notnull']) && $field['notnull']) ? ' NOT NULL' : '';
|
||||
<td class="normal"> $default = ' DEFAULT NULL';
|
||||
</td></tr>
|
||||
<tr><td>460</td>
|
||||
<td class="covered"> $unsigned = (isset($field['unsigned']) && $field['unsigned']) ? ' UNSIGNED' : '';
|
||||
<td class="normal"> }
|
||||
</td></tr>
|
||||
<tr><td>461</td>
|
||||
<td class="normal">
|
||||
<td class="normal"> */
|
||||
</td></tr>
|
||||
<tr><td>462</td>
|
||||
<td class="covered"> $name = $this->conn->quoteIdentifier($name, true);
|
||||
</td></tr>
|
||||
<tr><td>463</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>463</td>
|
||||
<td class="covered"> $notnull = (isset($field['notnull']) && $field['notnull']) ? ' NOT NULL' : '';
|
||||
</td></tr>
|
||||
<tr><td>464</td>
|
||||
<td class="covered"> return $name . ' ' . $this->getNativeDeclaration($field) . $unsigned . $default . $notnull . $autoinc;
|
||||
<td class="covered"> $unsigned = (isset($field['unsigned']) && $field['unsigned']) ? ' UNSIGNED' : '';
|
||||
</td></tr>
|
||||
<tr><td>465</td>
|
||||
<td class="orange"> }
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>466</td>
|
||||
<td class="covered"> $name = $this->conn->quoteIdentifier($name, true);
|
||||
</td></tr>
|
||||
<tr><td>467</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>468</td>
|
||||
<td class="covered"> return $name . ' ' . $this->getNativeDeclaration($field) . $unsigned . $default . $notnull . $autoinc;
|
||||
</td></tr>
|
||||
<tr><td>469</td>
|
||||
<td class="orange"> }
|
||||
</td></tr>
|
||||
<tr><td>470</td>
|
||||
<td class="covered">}</td></tr>
|
||||
</table></body></html>
|
@ -16,7 +16,7 @@
|
||||
<td class="normal">/*
|
||||
</td></tr>
|
||||
<tr><td>3</td>
|
||||
<td class="normal"> * $Id: Export.php 2963 2007-10-21 06:23:59Z Jonathan.Wage $
|
||||
<td class="normal"> * $Id: Export.php 3088 2007-11-08 18:52:08Z Jonathan.Wage $
|
||||
</td></tr>
|
||||
<tr><td>4</td>
|
||||
<td class="normal"> *
|
||||
@ -103,7 +103,7 @@
|
||||
<td class="normal"> * @since 1.0
|
||||
</td></tr>
|
||||
<tr><td>32</td>
|
||||
<td class="normal"> * @version $Revision: 2963 $
|
||||
<td class="normal"> * @version $Revision: 3088 $
|
||||
</td></tr>
|
||||
<tr><td>33</td>
|
||||
<td class="normal"> */
|
||||
@ -3235,509 +3235,512 @@
|
||||
<td class="covered"> $sql = $this->exportClassesSql(array($class));
|
||||
</td></tr>
|
||||
<tr><td>1076</td>
|
||||
<td class="normal"> // The create sql query is the first one, and everything else is the alters
|
||||
<td class="normal"> // Build array of all the creates
|
||||
</td></tr>
|
||||
<tr><td>1077</td>
|
||||
<td class="covered"> $create = $sql[0];
|
||||
<td class="normal"> // We need these to happen first
|
||||
</td></tr>
|
||||
<tr><td>1078</td>
|
||||
<td class="normal">
|
||||
<td class="covered"> foreach ($sql as $key => $query) {
|
||||
</td></tr>
|
||||
<tr><td>1079</td>
|
||||
<td class="normal"> // Remove create from the main array
|
||||
<td class="covered"> if (strstr($query, 'CREATE')) {
|
||||
</td></tr>
|
||||
<tr><td>1080</td>
|
||||
<td class="covered"> unset($sql[0]);
|
||||
<td class="covered"> $connections[$connectionName]['creates'][] = $query;
|
||||
</td></tr>
|
||||
<tr><td>1081</td>
|
||||
<td class="normal">
|
||||
<td class="normal"> // Unset the create from sql so we can have an array of everything else but creates
|
||||
</td></tr>
|
||||
<tr><td>1082</td>
|
||||
<td class="normal"> // Store the creates and alters individually so we can merge them back together later
|
||||
<td class="covered"> unset($sql[$key]);
|
||||
</td></tr>
|
||||
<tr><td>1083</td>
|
||||
<td class="normal"> // We need the creates to happen first, then the alters
|
||||
<td class="covered"> }
|
||||
</td></tr>
|
||||
<tr><td>1084</td>
|
||||
<td class="covered"> $connections[$connectionName]['creates'][] = $create;
|
||||
<td class="covered"> }
|
||||
</td></tr>
|
||||
<tr><td>1085</td>
|
||||
<td class="covered"> $connections[$connectionName]['alters'] = array_merge($connections[$connectionName]['alters'], $sql);
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1086</td>
|
||||
<td class="covered"> }
|
||||
<td class="covered"> $connections[$connectionName]['alters'] = array_merge($connections[$connectionName]['alters'], $sql);
|
||||
</td></tr>
|
||||
<tr><td>1087</td>
|
||||
<td class="normal">
|
||||
<td class="covered"> }
|
||||
</td></tr>
|
||||
<tr><td>1088</td>
|
||||
<td class="normal"> // Loop over all the sql again to merge the creates and alters in to the same array, but so that the alters are at the bottom
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1089</td>
|
||||
<td class="covered"> $build = array();
|
||||
<td class="normal"> // Loop over all the sql again to merge the creates and alters in to the same array, but so that the alters are at the bottom
|
||||
</td></tr>
|
||||
<tr><td>1090</td>
|
||||
<td class="covered"> foreach ($connections as $connectionName => $sql) {
|
||||
<td class="covered"> $build = array();
|
||||
</td></tr>
|
||||
<tr><td>1091</td>
|
||||
<td class="covered"> $build[$connectionName] = array_merge($sql['creates'], $sql['alters']);
|
||||
<td class="covered"> foreach ($connections as $connectionName => $sql) {
|
||||
</td></tr>
|
||||
<tr><td>1092</td>
|
||||
<td class="covered"> }
|
||||
<td class="covered"> $build[$connectionName] = array_merge($sql['creates'], $sql['alters']);
|
||||
</td></tr>
|
||||
<tr><td>1093</td>
|
||||
<td class="normal">
|
||||
<td class="covered"> }
|
||||
</td></tr>
|
||||
<tr><td>1094</td>
|
||||
<td class="covered"> foreach ($build as $connectionName => $sql) {
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1095</td>
|
||||
<td class="covered"> $connection = Doctrine_Manager::getInstance()->getConnection($connectionName);
|
||||
<td class="covered"> foreach ($build as $connectionName => $sql) {
|
||||
</td></tr>
|
||||
<tr><td>1096</td>
|
||||
<td class="normal">
|
||||
<td class="covered"> $connection = Doctrine_Manager::getInstance()->getConnection($connectionName);
|
||||
</td></tr>
|
||||
<tr><td>1097</td>
|
||||
<td class="covered"> $connection->beginTransaction();
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1098</td>
|
||||
<td class="normal">
|
||||
<td class="covered"> $connection->beginTransaction();
|
||||
</td></tr>
|
||||
<tr><td>1099</td>
|
||||
<td class="covered"> foreach ($sql as $query) {
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1100</td>
|
||||
<td class="normal"> try {
|
||||
<td class="covered"> foreach ($sql as $query) {
|
||||
</td></tr>
|
||||
<tr><td>1101</td>
|
||||
<td class="covered"> $connection->exec($query);
|
||||
<td class="normal"> try {
|
||||
</td></tr>
|
||||
<tr><td>1102</td>
|
||||
<td class="covered"> } catch (Doctrine_Connection_Exception $e) {
|
||||
<td class="covered"> $connection->exec($query);
|
||||
</td></tr>
|
||||
<tr><td>1103</td>
|
||||
<td class="normal"> // we only want to silence table already exists errors
|
||||
<td class="covered"> } catch (Doctrine_Connection_Exception $e) {
|
||||
</td></tr>
|
||||
<tr><td>1104</td>
|
||||
<td class="covered"> if ($e->getPortableCode() !== Doctrine::ERR_ALREADY_EXISTS) {
|
||||
<td class="normal"> // we only want to silence table already exists errors
|
||||
</td></tr>
|
||||
<tr><td>1105</td>
|
||||
<td class="orange"> $connection->rollback();
|
||||
<td class="covered"> if ($e->getPortableCode() !== Doctrine::ERR_ALREADY_EXISTS) {
|
||||
</td></tr>
|
||||
<tr><td>1106</td>
|
||||
<td class="orange"> throw new Doctrine_Export_Exception($e->getMessage() . '. Failing Query: ' . $query);
|
||||
<td class="orange"> $connection->rollback();
|
||||
</td></tr>
|
||||
<tr><td>1107</td>
|
||||
<td class="orange"> }
|
||||
<td class="orange"> throw new Doctrine_Export_Exception($e->getMessage() . '. Failing Query: ' . $query);
|
||||
</td></tr>
|
||||
<tr><td>1108</td>
|
||||
<td class="normal"> }
|
||||
<td class="orange"> }
|
||||
</td></tr>
|
||||
<tr><td>1109</td>
|
||||
<td class="covered"> }
|
||||
<td class="normal"> }
|
||||
</td></tr>
|
||||
<tr><td>1110</td>
|
||||
<td class="normal">
|
||||
<td class="covered"> }
|
||||
</td></tr>
|
||||
<tr><td>1111</td>
|
||||
<td class="covered"> $connection->commit();
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1112</td>
|
||||
<td class="covered"> }
|
||||
<td class="covered"> $connection->commit();
|
||||
</td></tr>
|
||||
<tr><td>1113</td>
|
||||
<td class="covered"> }
|
||||
<td class="covered"> }
|
||||
</td></tr>
|
||||
<tr><td>1114</td>
|
||||
<td class="normal">
|
||||
<td class="covered"> }
|
||||
</td></tr>
|
||||
<tr><td>1115</td>
|
||||
<td class="normal"> /**
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1116</td>
|
||||
<td class="normal"> * exportClassesSql
|
||||
<td class="normal"> /**
|
||||
</td></tr>
|
||||
<tr><td>1117</td>
|
||||
<td class="normal"> * method for exporting Doctrine_Record classes to a schema
|
||||
<td class="normal"> * exportClassesSql
|
||||
</td></tr>
|
||||
<tr><td>1118</td>
|
||||
<td class="normal"> *
|
||||
<td class="normal"> * method for exporting Doctrine_Record classes to a schema
|
||||
</td></tr>
|
||||
<tr><td>1119</td>
|
||||
<td class="normal"> * @throws Doctrine_Connection_Exception if some error other than Doctrine::ERR_ALREADY_EXISTS
|
||||
<td class="normal"> *
|
||||
</td></tr>
|
||||
<tr><td>1120</td>
|
||||
<td class="normal"> * occurred during the create table operation
|
||||
<td class="normal"> * @throws Doctrine_Connection_Exception if some error other than Doctrine::ERR_ALREADY_EXISTS
|
||||
</td></tr>
|
||||
<tr><td>1121</td>
|
||||
<td class="normal"> * @param array $classes
|
||||
<td class="normal"> * occurred during the create table operation
|
||||
</td></tr>
|
||||
<tr><td>1122</td>
|
||||
<td class="normal"> * @return void
|
||||
<td class="normal"> * @param array $classes
|
||||
</td></tr>
|
||||
<tr><td>1123</td>
|
||||
<td class="normal"> */
|
||||
</td></tr>
|
||||
<tr><td>1124</td>
|
||||
<td class="normal"> public function exportClassesSql(array $classes)
|
||||
</td></tr>
|
||||
<tr><td>1125</td>
|
||||
<td class="normal"> {
|
||||
</td></tr>
|
||||
<tr><td>1126</td>
|
||||
<td class="covered"> $models = Doctrine::getLoadedModels($classes);
|
||||
</td></tr>
|
||||
<tr><td>1127</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1128</td>
|
||||
<td class="covered"> $sql = array();
|
||||
</td></tr>
|
||||
<tr><td>1129</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1130</td>
|
||||
<td class="covered"> foreach ($models as $name) {
|
||||
</td></tr>
|
||||
<tr><td>1131</td>
|
||||
<td class="covered"> $record = new $name();
|
||||
</td></tr>
|
||||
<tr><td>1132</td>
|
||||
<td class="covered"> $table = $record->getTable();
|
||||
</td></tr>
|
||||
<tr><td>1133</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1134</td>
|
||||
<td class="covered"> $data = $table->getExportableFormat();
|
||||
</td></tr>
|
||||
<tr><td>1135</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1136</td>
|
||||
<td class="covered"> $query = $this->conn->export->createTableSql($data['tableName'], $data['columns'], $data['options']);
|
||||
</td></tr>
|
||||
<tr><td>1137</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1138</td>
|
||||
<td class="covered"> if (is_array($query)) {
|
||||
</td></tr>
|
||||
<tr><td>1139</td>
|
||||
<td class="covered"> $sql = array_merge($sql, $query);
|
||||
</td></tr>
|
||||
<tr><td>1140</td>
|
||||
<td class="covered"> } else {
|
||||
</td></tr>
|
||||
<tr><td>1141</td>
|
||||
<td class="red"> $sql[] = $query;
|
||||
</td></tr>
|
||||
<tr><td>1142</td>
|
||||
<td class="normal"> }
|
||||
</td></tr>
|
||||
<tr><td>1143</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1144</td>
|
||||
<td class="covered"> if ($table->getAttribute(Doctrine::ATTR_EXPORT) & Doctrine::EXPORT_PLUGINS) {
|
||||
</td></tr>
|
||||
<tr><td>1145</td>
|
||||
<td class="covered"> $sql = array_merge($sql, $this->exportPluginsSql($table));
|
||||
</td></tr>
|
||||
<tr><td>1146</td>
|
||||
<td class="covered"> }
|
||||
</td></tr>
|
||||
<tr><td>1147</td>
|
||||
<td class="covered"> }
|
||||
</td></tr>
|
||||
<tr><td>1148</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1149</td>
|
||||
<td class="covered"> $sql = array_unique($sql);
|
||||
</td></tr>
|
||||
<tr><td>1150</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1151</td>
|
||||
<td class="covered"> rsort($sql);
|
||||
</td></tr>
|
||||
<tr><td>1152</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1153</td>
|
||||
<td class="covered"> return $sql;
|
||||
</td></tr>
|
||||
<tr><td>1154</td>
|
||||
<td class="orange"> }
|
||||
</td></tr>
|
||||
<tr><td>1155</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1156</td>
|
||||
<td class="normal"> /**
|
||||
</td></tr>
|
||||
<tr><td>1157</td>
|
||||
<td class="normal"> * exportPluginsSql
|
||||
</td></tr>
|
||||
<tr><td>1158</td>
|
||||
<td class="normal"> * exports plugin tables for given table
|
||||
</td></tr>
|
||||
<tr><td>1159</td>
|
||||
<td class="normal"> *
|
||||
</td></tr>
|
||||
<tr><td>1160</td>
|
||||
<td class="normal"> * @param Doctrine_Table $table the table in which the plugins belong to
|
||||
</td></tr>
|
||||
<tr><td>1161</td>
|
||||
<td class="normal"> * @return array an array of sql strings
|
||||
</td></tr>
|
||||
<tr><td>1162</td>
|
||||
<td class="normal"> */
|
||||
</td></tr>
|
||||
<tr><td>1163</td>
|
||||
<td class="normal"> public function exportPluginsSql(Doctrine_Table $table)
|
||||
</td></tr>
|
||||
<tr><td>1164</td>
|
||||
<td class="normal"> {
|
||||
</td></tr>
|
||||
<tr><td>1165</td>
|
||||
<td class="covered"> $sql = array();
|
||||
</td></tr>
|
||||
<tr><td>1166</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1167</td>
|
||||
<td class="covered"> foreach ($table->getTemplates() as $name => $template) {
|
||||
</td></tr>
|
||||
<tr><td>1168</td>
|
||||
<td class="covered"> $plugin = $template->getPlugin();
|
||||
</td></tr>
|
||||
<tr><td>1169</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1170</td>
|
||||
<td class="covered"> if ($plugin === null) {
|
||||
</td></tr>
|
||||
<tr><td>1171</td>
|
||||
<td class="covered"> continue;
|
||||
</td></tr>
|
||||
<tr><td>1172</td>
|
||||
<td class="orange"> }
|
||||
</td></tr>
|
||||
<tr><td>1173</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1174</td>
|
||||
<td class="covered"> $table = $plugin->getOption('pluginTable');
|
||||
</td></tr>
|
||||
<tr><td>1175</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1176</td>
|
||||
<td class="normal"> // Make sure plugin has a valid table
|
||||
</td></tr>
|
||||
<tr><td>1177</td>
|
||||
<td class="covered"> if ($table instanceof Doctrine_Table) {
|
||||
</td></tr>
|
||||
<tr><td>1178</td>
|
||||
<td class="covered"> $data = $table->getExportableFormat();
|
||||
</td></tr>
|
||||
<tr><td>1179</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1180</td>
|
||||
<td class="covered"> $query = $this->conn->export->createTableSql($data['tableName'], $data['columns'], $data['options']);
|
||||
</td></tr>
|
||||
<tr><td>1181</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1182</td>
|
||||
<td class="covered"> $sql = array_merge($sql, (array) $query);
|
||||
</td></tr>
|
||||
<tr><td>1183</td>
|
||||
<td class="covered"> }
|
||||
</td></tr>
|
||||
<tr><td>1184</td>
|
||||
<td class="covered"> }
|
||||
</td></tr>
|
||||
<tr><td>1185</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1186</td>
|
||||
<td class="covered"> return $sql;
|
||||
</td></tr>
|
||||
<tr><td>1187</td>
|
||||
<td class="orange"> }
|
||||
</td></tr>
|
||||
<tr><td>1188</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1189</td>
|
||||
<td class="normal"> /**
|
||||
</td></tr>
|
||||
<tr><td>1190</td>
|
||||
<td class="normal"> * exportSql
|
||||
</td></tr>
|
||||
<tr><td>1191</td>
|
||||
<td class="normal"> * returns the sql for exporting Doctrine_Record classes to a schema
|
||||
</td></tr>
|
||||
<tr><td>1192</td>
|
||||
<td class="normal"> *
|
||||
</td></tr>
|
||||
<tr><td>1193</td>
|
||||
<td class="normal"> * if the directory parameter is given this method first iterates
|
||||
</td></tr>
|
||||
<tr><td>1194</td>
|
||||
<td class="normal"> * recursively trhough the given directory in order to find any model classes
|
||||
</td></tr>
|
||||
<tr><td>1195</td>
|
||||
<td class="normal"> *
|
||||
</td></tr>
|
||||
<tr><td>1196</td>
|
||||
<td class="normal"> * Then it iterates through all declared classes and creates tables for the ones
|
||||
</td></tr>
|
||||
<tr><td>1197</td>
|
||||
<td class="normal"> * that extend Doctrine_Record and are not abstract classes
|
||||
</td></tr>
|
||||
<tr><td>1198</td>
|
||||
<td class="normal"> *
|
||||
</td></tr>
|
||||
<tr><td>1199</td>
|
||||
<td class="normal"> * @throws Doctrine_Connection_Exception if some error other than Doctrine::ERR_ALREADY_EXISTS
|
||||
</td></tr>
|
||||
<tr><td>1200</td>
|
||||
<td class="normal"> * occurred during the create table operation
|
||||
</td></tr>
|
||||
<tr><td>1201</td>
|
||||
<td class="normal"> * @param string $directory optional directory parameter
|
||||
</td></tr>
|
||||
<tr><td>1202</td>
|
||||
<td class="normal"> * @return void
|
||||
</td></tr>
|
||||
<tr><td>1203</td>
|
||||
<tr><td>1124</td>
|
||||
<td class="normal"> */
|
||||
</td></tr>
|
||||
<tr><td>1204</td>
|
||||
<td class="normal"> public function exportSql($directory = null)
|
||||
<tr><td>1125</td>
|
||||
<td class="normal"> public function exportClassesSql(array $classes)
|
||||
</td></tr>
|
||||
<tr><td>1205</td>
|
||||
<tr><td>1126</td>
|
||||
<td class="normal"> {
|
||||
</td></tr>
|
||||
<tr><td>1206</td>
|
||||
<td class="red"> if ($directory !== null) {
|
||||
<tr><td>1127</td>
|
||||
<td class="covered"> $models = Doctrine::getLoadedModels($classes);
|
||||
</td></tr>
|
||||
<tr><td>1207</td>
|
||||
<td class="red"> $models = Doctrine::loadModels($directory);
|
||||
</td></tr>
|
||||
<tr><td>1208</td>
|
||||
<td class="red"> } else {
|
||||
</td></tr>
|
||||
<tr><td>1209</td>
|
||||
<td class="red"> $models = Doctrine::getLoadedModels();
|
||||
</td></tr>
|
||||
<tr><td>1210</td>
|
||||
<td class="normal"> }
|
||||
</td></tr>
|
||||
<tr><td>1211</td>
|
||||
<tr><td>1128</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1212</td>
|
||||
<td class="red"> return $this->exportClassesSql($models);
|
||||
<tr><td>1129</td>
|
||||
<td class="covered"> $sql = array();
|
||||
</td></tr>
|
||||
<tr><td>1213</td>
|
||||
<tr><td>1130</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1131</td>
|
||||
<td class="covered"> foreach ($models as $name) {
|
||||
</td></tr>
|
||||
<tr><td>1132</td>
|
||||
<td class="covered"> $record = new $name();
|
||||
</td></tr>
|
||||
<tr><td>1133</td>
|
||||
<td class="covered"> $table = $record->getTable();
|
||||
</td></tr>
|
||||
<tr><td>1134</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1135</td>
|
||||
<td class="covered"> $data = $table->getExportableFormat();
|
||||
</td></tr>
|
||||
<tr><td>1136</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1137</td>
|
||||
<td class="covered"> $query = $this->conn->export->createTableSql($data['tableName'], $data['columns'], $data['options']);
|
||||
</td></tr>
|
||||
<tr><td>1138</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1139</td>
|
||||
<td class="covered"> if (is_array($query)) {
|
||||
</td></tr>
|
||||
<tr><td>1140</td>
|
||||
<td class="covered"> $sql = array_merge($sql, $query);
|
||||
</td></tr>
|
||||
<tr><td>1141</td>
|
||||
<td class="covered"> } else {
|
||||
</td></tr>
|
||||
<tr><td>1142</td>
|
||||
<td class="red"> $sql[] = $query;
|
||||
</td></tr>
|
||||
<tr><td>1143</td>
|
||||
<td class="normal"> }
|
||||
</td></tr>
|
||||
<tr><td>1144</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1145</td>
|
||||
<td class="covered"> if ($table->getAttribute(Doctrine::ATTR_EXPORT) & Doctrine::EXPORT_PLUGINS) {
|
||||
</td></tr>
|
||||
<tr><td>1146</td>
|
||||
<td class="covered"> $sql = array_merge($sql, $this->exportPluginsSql($table));
|
||||
</td></tr>
|
||||
<tr><td>1147</td>
|
||||
<td class="covered"> }
|
||||
</td></tr>
|
||||
<tr><td>1148</td>
|
||||
<td class="covered"> }
|
||||
</td></tr>
|
||||
<tr><td>1149</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1150</td>
|
||||
<td class="covered"> $sql = array_unique($sql);
|
||||
</td></tr>
|
||||
<tr><td>1151</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1152</td>
|
||||
<td class="covered"> rsort($sql);
|
||||
</td></tr>
|
||||
<tr><td>1153</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1154</td>
|
||||
<td class="covered"> return $sql;
|
||||
</td></tr>
|
||||
<tr><td>1155</td>
|
||||
<td class="orange"> }
|
||||
</td></tr>
|
||||
<tr><td>1214</td>
|
||||
<tr><td>1156</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1215</td>
|
||||
<tr><td>1157</td>
|
||||
<td class="normal"> /**
|
||||
</td></tr>
|
||||
<tr><td>1216</td>
|
||||
<td class="normal"> * exportTable
|
||||
<tr><td>1158</td>
|
||||
<td class="normal"> * exportPluginsSql
|
||||
</td></tr>
|
||||
<tr><td>1217</td>
|
||||
<td class="normal"> * exports given table into database based on column and option definitions
|
||||
<tr><td>1159</td>
|
||||
<td class="normal"> * exports plugin tables for given table
|
||||
</td></tr>
|
||||
<tr><td>1218</td>
|
||||
<tr><td>1160</td>
|
||||
<td class="normal"> *
|
||||
</td></tr>
|
||||
<tr><td>1219</td>
|
||||
<td class="normal"> * @throws Doctrine_Connection_Exception if some error other than Doctrine::ERR_ALREADY_EXISTS
|
||||
<tr><td>1161</td>
|
||||
<td class="normal"> * @param Doctrine_Table $table the table in which the plugins belong to
|
||||
</td></tr>
|
||||
<tr><td>1220</td>
|
||||
<td class="normal"> * occurred during the create table operation
|
||||
<tr><td>1162</td>
|
||||
<td class="normal"> * @return array an array of sql strings
|
||||
</td></tr>
|
||||
<tr><td>1221</td>
|
||||
<td class="normal"> * @return boolean whether or not the export operation was successful
|
||||
</td></tr>
|
||||
<tr><td>1222</td>
|
||||
<td class="normal"> * false if table already existed in the database
|
||||
</td></tr>
|
||||
<tr><td>1223</td>
|
||||
<tr><td>1163</td>
|
||||
<td class="normal"> */
|
||||
</td></tr>
|
||||
<tr><td>1224</td>
|
||||
<td class="normal"> public function exportTable(Doctrine_Table $table)
|
||||
<tr><td>1164</td>
|
||||
<td class="normal"> public function exportPluginsSql(Doctrine_Table $table)
|
||||
</td></tr>
|
||||
<tr><td>1225</td>
|
||||
<tr><td>1165</td>
|
||||
<td class="normal"> {
|
||||
</td></tr>
|
||||
<tr><td>1226</td>
|
||||
<td class="normal"> /**
|
||||
<tr><td>1166</td>
|
||||
<td class="covered"> $sql = array();
|
||||
</td></tr>
|
||||
<tr><td>1227</td>
|
||||
<td class="normal"> TODO: maybe there should be portability option for the following check
|
||||
</td></tr>
|
||||
<tr><td>1228</td>
|
||||
<td class="normal"> if ( ! Doctrine::isValidClassname($table->getOption('declaringClass')->getName())) {
|
||||
</td></tr>
|
||||
<tr><td>1229</td>
|
||||
<td class="normal"> throw new Doctrine_Export_Exception('Class name not valid.');
|
||||
</td></tr>
|
||||
<tr><td>1230</td>
|
||||
<td class="normal"> }
|
||||
</td></tr>
|
||||
<tr><td>1231</td>
|
||||
<td class="normal"> */
|
||||
</td></tr>
|
||||
<tr><td>1232</td>
|
||||
<tr><td>1167</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1233</td>
|
||||
<td class="normal"> try {
|
||||
<tr><td>1168</td>
|
||||
<td class="covered"> foreach ($table->getTemplates() as $name => $template) {
|
||||
</td></tr>
|
||||
<tr><td>1234</td>
|
||||
<td class="red"> $data = $table->getExportableFormat();
|
||||
<tr><td>1169</td>
|
||||
<td class="covered"> $plugin = $template->getPlugin();
|
||||
</td></tr>
|
||||
<tr><td>1235</td>
|
||||
<tr><td>1170</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1236</td>
|
||||
<td class="red"> $this->conn->export->createTable($data['tableName'], $data['columns'], $data['options']);
|
||||
<tr><td>1171</td>
|
||||
<td class="covered"> if ($plugin === null) {
|
||||
</td></tr>
|
||||
<tr><td>1237</td>
|
||||
<td class="red"> } catch(Doctrine_Connection_Exception $e) {
|
||||
<tr><td>1172</td>
|
||||
<td class="covered"> continue;
|
||||
</td></tr>
|
||||
<tr><td>1238</td>
|
||||
<td class="normal"> // we only want to silence table already exists errors
|
||||
</td></tr>
|
||||
<tr><td>1239</td>
|
||||
<td class="orange"> if ($e->getPortableCode() !== Doctrine::ERR_ALREADY_EXISTS) {
|
||||
</td></tr>
|
||||
<tr><td>1240</td>
|
||||
<td class="orange"> throw $e;
|
||||
</td></tr>
|
||||
<tr><td>1241</td>
|
||||
<tr><td>1173</td>
|
||||
<td class="orange"> }
|
||||
</td></tr>
|
||||
<tr><td>1242</td>
|
||||
<tr><td>1174</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1175</td>
|
||||
<td class="covered"> $table = $plugin->getOption('pluginTable');
|
||||
</td></tr>
|
||||
<tr><td>1176</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1177</td>
|
||||
<td class="normal"> // Make sure plugin has a valid table
|
||||
</td></tr>
|
||||
<tr><td>1178</td>
|
||||
<td class="covered"> if ($table instanceof Doctrine_Table) {
|
||||
</td></tr>
|
||||
<tr><td>1179</td>
|
||||
<td class="covered"> $data = $table->getExportableFormat();
|
||||
</td></tr>
|
||||
<tr><td>1180</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1181</td>
|
||||
<td class="covered"> $query = $this->conn->export->createTableSql($data['tableName'], $data['columns'], $data['options']);
|
||||
</td></tr>
|
||||
<tr><td>1182</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1183</td>
|
||||
<td class="covered"> $sql = array_merge($sql, (array) $query);
|
||||
</td></tr>
|
||||
<tr><td>1184</td>
|
||||
<td class="covered"> }
|
||||
</td></tr>
|
||||
<tr><td>1185</td>
|
||||
<td class="covered"> }
|
||||
</td></tr>
|
||||
<tr><td>1186</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1187</td>
|
||||
<td class="covered"> return $sql;
|
||||
</td></tr>
|
||||
<tr><td>1188</td>
|
||||
<td class="orange"> }
|
||||
</td></tr>
|
||||
<tr><td>1189</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1190</td>
|
||||
<td class="normal"> /**
|
||||
</td></tr>
|
||||
<tr><td>1191</td>
|
||||
<td class="normal"> * exportSql
|
||||
</td></tr>
|
||||
<tr><td>1192</td>
|
||||
<td class="normal"> * returns the sql for exporting Doctrine_Record classes to a schema
|
||||
</td></tr>
|
||||
<tr><td>1193</td>
|
||||
<td class="normal"> *
|
||||
</td></tr>
|
||||
<tr><td>1194</td>
|
||||
<td class="normal"> * if the directory parameter is given this method first iterates
|
||||
</td></tr>
|
||||
<tr><td>1195</td>
|
||||
<td class="normal"> * recursively trhough the given directory in order to find any model classes
|
||||
</td></tr>
|
||||
<tr><td>1196</td>
|
||||
<td class="normal"> *
|
||||
</td></tr>
|
||||
<tr><td>1197</td>
|
||||
<td class="normal"> * Then it iterates through all declared classes and creates tables for the ones
|
||||
</td></tr>
|
||||
<tr><td>1198</td>
|
||||
<td class="normal"> * that extend Doctrine_Record and are not abstract classes
|
||||
</td></tr>
|
||||
<tr><td>1199</td>
|
||||
<td class="normal"> *
|
||||
</td></tr>
|
||||
<tr><td>1200</td>
|
||||
<td class="normal"> * @throws Doctrine_Connection_Exception if some error other than Doctrine::ERR_ALREADY_EXISTS
|
||||
</td></tr>
|
||||
<tr><td>1201</td>
|
||||
<td class="normal"> * occurred during the create table operation
|
||||
</td></tr>
|
||||
<tr><td>1202</td>
|
||||
<td class="normal"> * @param string $directory optional directory parameter
|
||||
</td></tr>
|
||||
<tr><td>1203</td>
|
||||
<td class="normal"> * @return void
|
||||
</td></tr>
|
||||
<tr><td>1204</td>
|
||||
<td class="normal"> */
|
||||
</td></tr>
|
||||
<tr><td>1205</td>
|
||||
<td class="normal"> public function exportSql($directory = null)
|
||||
</td></tr>
|
||||
<tr><td>1206</td>
|
||||
<td class="normal"> {
|
||||
</td></tr>
|
||||
<tr><td>1207</td>
|
||||
<td class="red"> if ($directory !== null) {
|
||||
</td></tr>
|
||||
<tr><td>1208</td>
|
||||
<td class="red"> $models = Doctrine::loadModels($directory);
|
||||
</td></tr>
|
||||
<tr><td>1209</td>
|
||||
<td class="red"> } else {
|
||||
</td></tr>
|
||||
<tr><td>1210</td>
|
||||
<td class="red"> $models = Doctrine::getLoadedModels();
|
||||
</td></tr>
|
||||
<tr><td>1211</td>
|
||||
<td class="normal"> }
|
||||
</td></tr>
|
||||
<tr><td>1212</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1213</td>
|
||||
<td class="red"> return $this->exportClassesSql($models);
|
||||
</td></tr>
|
||||
<tr><td>1214</td>
|
||||
<td class="orange"> }
|
||||
</td></tr>
|
||||
<tr><td>1215</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1216</td>
|
||||
<td class="normal"> /**
|
||||
</td></tr>
|
||||
<tr><td>1217</td>
|
||||
<td class="normal"> * exportTable
|
||||
</td></tr>
|
||||
<tr><td>1218</td>
|
||||
<td class="normal"> * exports given table into database based on column and option definitions
|
||||
</td></tr>
|
||||
<tr><td>1219</td>
|
||||
<td class="normal"> *
|
||||
</td></tr>
|
||||
<tr><td>1220</td>
|
||||
<td class="normal"> * @throws Doctrine_Connection_Exception if some error other than Doctrine::ERR_ALREADY_EXISTS
|
||||
</td></tr>
|
||||
<tr><td>1221</td>
|
||||
<td class="normal"> * occurred during the create table operation
|
||||
</td></tr>
|
||||
<tr><td>1222</td>
|
||||
<td class="normal"> * @return boolean whether or not the export operation was successful
|
||||
</td></tr>
|
||||
<tr><td>1223</td>
|
||||
<td class="normal"> * false if table already existed in the database
|
||||
</td></tr>
|
||||
<tr><td>1224</td>
|
||||
<td class="normal"> */
|
||||
</td></tr>
|
||||
<tr><td>1225</td>
|
||||
<td class="normal"> public function exportTable(Doctrine_Table $table)
|
||||
</td></tr>
|
||||
<tr><td>1226</td>
|
||||
<td class="normal"> {
|
||||
</td></tr>
|
||||
<tr><td>1227</td>
|
||||
<td class="normal"> /**
|
||||
</td></tr>
|
||||
<tr><td>1228</td>
|
||||
<td class="normal"> TODO: maybe there should be portability option for the following check
|
||||
</td></tr>
|
||||
<tr><td>1229</td>
|
||||
<td class="normal"> if ( ! Doctrine::isValidClassname($table->getOption('declaringClass')->getName())) {
|
||||
</td></tr>
|
||||
<tr><td>1230</td>
|
||||
<td class="normal"> throw new Doctrine_Export_Exception('Class name not valid.');
|
||||
</td></tr>
|
||||
<tr><td>1231</td>
|
||||
<td class="normal"> }
|
||||
</td></tr>
|
||||
<tr><td>1232</td>
|
||||
<td class="normal"> */
|
||||
</td></tr>
|
||||
<tr><td>1233</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1234</td>
|
||||
<td class="normal"> try {
|
||||
</td></tr>
|
||||
<tr><td>1235</td>
|
||||
<td class="red"> $data = $table->getExportableFormat();
|
||||
</td></tr>
|
||||
<tr><td>1236</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1237</td>
|
||||
<td class="red"> $this->conn->export->createTable($data['tableName'], $data['columns'], $data['options']);
|
||||
</td></tr>
|
||||
<tr><td>1238</td>
|
||||
<td class="red"> } catch(Doctrine_Connection_Exception $e) {
|
||||
</td></tr>
|
||||
<tr><td>1239</td>
|
||||
<td class="normal"> // we only want to silence table already exists errors
|
||||
</td></tr>
|
||||
<tr><td>1240</td>
|
||||
<td class="orange"> if ($e->getPortableCode() !== Doctrine::ERR_ALREADY_EXISTS) {
|
||||
</td></tr>
|
||||
<tr><td>1241</td>
|
||||
<td class="orange"> throw $e;
|
||||
</td></tr>
|
||||
<tr><td>1242</td>
|
||||
<td class="orange"> }
|
||||
</td></tr>
|
||||
<tr><td>1243</td>
|
||||
<td class="red"> }
|
||||
<td class="normal"> }
|
||||
</td></tr>
|
||||
<tr><td>1244</td>
|
||||
<td class="red"> }
|
||||
</td></tr>
|
||||
<tr><td>1245</td>
|
||||
<td class="covered">}</td></tr>
|
||||
</table></body></html>
|
@ -16,7 +16,7 @@
|
||||
<td class="normal">/*
|
||||
</td></tr>
|
||||
<tr><td>3</td>
|
||||
<td class="normal"> * $Id: Builder.php 3062 2007-11-01 23:54:27Z Jonathan.Wage $
|
||||
<td class="normal"> * $Id: Builder.php 3082 2007-11-08 00:29:15Z Jonathan.Wage $
|
||||
</td></tr>
|
||||
<tr><td>4</td>
|
||||
<td class="normal"> *
|
||||
@ -106,7 +106,7 @@
|
||||
<td class="normal"> * @since 1.0
|
||||
</td></tr>
|
||||
<tr><td>33</td>
|
||||
<td class="normal"> * @version $Revision: 3062 $
|
||||
<td class="normal"> * @version $Revision: 3082 $
|
||||
</td></tr>
|
||||
<tr><td>34</td>
|
||||
<td class="normal"> * @author Konsta Vesterinen <kvesteri@cc.hut.fi>
|
||||
@ -2524,7 +2524,7 @@
|
||||
<td class="covered"> if (isset($options['is_package_class']) && $options['is_package_class']) {
|
||||
</td></tr>
|
||||
<tr><td>839</td>
|
||||
<td class="red"> $path = str_replace('.', DIRECTORY_SEPARATOR, $options['package']);
|
||||
<td class="red"> $path = str_replace('.', DIRECTORY_SEPARATOR, trim($options['package']));
|
||||
</td></tr>
|
||||
<tr><td>840</td>
|
||||
<td class="normal">
|
||||
|
@ -325,7 +325,7 @@
|
||||
<td class="covered"> if (is_file($s)) {
|
||||
</td></tr>
|
||||
<tr><td>106</td>
|
||||
<td class="covered"> $array = array_merge($array, $this->parseSchema($s, $format));
|
||||
<td class="covered"> $array = array_merge($this->parseSchema($s, $format), $array);
|
||||
</td></tr>
|
||||
<tr><td>107</td>
|
||||
<td class="covered"> } else if (is_dir($s)) {
|
||||
@ -349,7 +349,7 @@
|
||||
<td class="red"> if (end($e) === $format) {
|
||||
</td></tr>
|
||||
<tr><td>114</td>
|
||||
<td class="red"> $array = array_merge($array, $this->parseSchema($file->getPathName(), $format));
|
||||
<td class="red"> $array = array_merge($this->parseSchema($file->getPathName(), $format), $array);
|
||||
</td></tr>
|
||||
<tr><td>115</td>
|
||||
<td class="red"> }
|
||||
|
@ -385,7 +385,7 @@
|
||||
<td class="covered"> if ($this->_migrationClasses) {
|
||||
</td></tr>
|
||||
<tr><td>126</td>
|
||||
<td class="red"> return $this->_migrationClasses;
|
||||
<td class="covered"> return $this->_migrationClasses;
|
||||
</td></tr>
|
||||
<tr><td>127</td>
|
||||
<td class="orange"> }
|
||||
@ -757,34 +757,34 @@
|
||||
<td class="normal"> {
|
||||
</td></tr>
|
||||
<tr><td>250</td>
|
||||
<td class="red"> $this->loadMigrationClasses();
|
||||
<td class="covered"> $this->loadMigrationClasses();
|
||||
</td></tr>
|
||||
<tr><td>251</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>252</td>
|
||||
<td class="red"> $versions = array();
|
||||
<td class="covered"> $versions = array();
|
||||
</td></tr>
|
||||
<tr><td>253</td>
|
||||
<td class="red"> foreach (array_keys($this->_migrationClasses) as $classMigrationNum) {
|
||||
<td class="covered"> foreach (array_keys($this->_migrationClasses) as $classMigrationNum) {
|
||||
</td></tr>
|
||||
<tr><td>254</td>
|
||||
<td class="red"> $versions[$classMigrationNum] = $classMigrationNum;
|
||||
<td class="covered"> $versions[$classMigrationNum] = $classMigrationNum;
|
||||
</td></tr>
|
||||
<tr><td>255</td>
|
||||
<td class="red"> }
|
||||
<td class="covered"> }
|
||||
</td></tr>
|
||||
<tr><td>256</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>257</td>
|
||||
<td class="red"> rsort($versions);
|
||||
<td class="covered"> rsort($versions);
|
||||
</td></tr>
|
||||
<tr><td>258</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>259</td>
|
||||
<td class="red"> return isset($versions[0]) ? $versions[0]:0;
|
||||
<td class="covered"> return isset($versions[0]) ? $versions[0]:0;
|
||||
</td></tr>
|
||||
<tr><td>260</td>
|
||||
<td class="orange"> }
|
||||
@ -871,7 +871,7 @@
|
||||
<td class="orange"> }
|
||||
</td></tr>
|
||||
<tr><td>288</td>
|
||||
<td class="covered"> }
|
||||
<td class="red"> }
|
||||
</td></tr>
|
||||
<tr><td>289</td>
|
||||
<td class="normal">
|
||||
|
@ -364,386 +364,401 @@
|
||||
<td class="red"> foreach ($columns as $column) {
|
||||
</td></tr>
|
||||
<tr><td>119</td>
|
||||
<td class="red"> $conn = $this->getConnection($column['tableName']);
|
||||
<td class="red"> $conn = $this->getConnection($column['tableName']);
|
||||
</td></tr>
|
||||
<tr><td>120</td>
|
||||
<td class="normal">
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>121</td>
|
||||
<td class="red"> $conn->export->alterTable($column['tableName'], array('rename' => array($column['oldColumnName'] => array('name' => $column['newColumnName']))));
|
||||
<td class="red"> $columnList = $conn->import->listTableColumns($column['tableName']);
|
||||
</td></tr>
|
||||
<tr><td>122</td>
|
||||
<td class="red"> }
|
||||
<td class="red"> if (isset($columnList[$column['oldColumnName']])) {
|
||||
</td></tr>
|
||||
<tr><td>123</td>
|
||||
<td class="red"> }
|
||||
<td class="red"> $conn->export->alterTable($column['tableName'],
|
||||
</td></tr>
|
||||
<tr><td>124</td>
|
||||
<td class="normal">
|
||||
<td class="red"> array('rename' => array($column['oldColumnName'] => array('name' => $column['newColumnName'],
|
||||
</td></tr>
|
||||
<tr><td>125</td>
|
||||
<td class="normal"> /**
|
||||
<td class="red"> 'definition'=>$columnList[$column['oldColumnName']]))));
|
||||
</td></tr>
|
||||
<tr><td>126</td>
|
||||
<td class="normal"> * processChangedColumns
|
||||
<td class="red"> }
|
||||
</td></tr>
|
||||
<tr><td>127</td>
|
||||
<td class="normal"> *
|
||||
<td class="red"> }
|
||||
</td></tr>
|
||||
<tr><td>128</td>
|
||||
<td class="normal"> * @param string $columns
|
||||
<td class="red"> }
|
||||
</td></tr>
|
||||
<tr><td>129</td>
|
||||
<td class="normal"> * @return void
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>130</td>
|
||||
<td class="normal"> */
|
||||
<td class="normal"> /**
|
||||
</td></tr>
|
||||
<tr><td>131</td>
|
||||
<td class="normal"> public function processChangedColumns($columns)
|
||||
<td class="normal"> * processChangedColumns
|
||||
</td></tr>
|
||||
<tr><td>132</td>
|
||||
<td class="normal"> {
|
||||
<td class="normal"> *
|
||||
</td></tr>
|
||||
<tr><td>133</td>
|
||||
<td class="red"> foreach ($columns as $column) {
|
||||
</td></tr>
|
||||
<tr><td>134</td>
|
||||
<td class="red"> $conn = $this->getConnection($column['tableName']);
|
||||
</td></tr>
|
||||
<tr><td>135</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>136</td>
|
||||
<td class="red"> $options = array();
|
||||
</td></tr>
|
||||
<tr><td>137</td>
|
||||
<td class="red"> $options = $column['options'];
|
||||
</td></tr>
|
||||
<tr><td>138</td>
|
||||
<td class="red"> $options['type'] = $column['type'];
|
||||
</td></tr>
|
||||
<tr><td>139</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>140</td>
|
||||
<td class="red"> $conn->export->alterTable($column['tableName'], array('change' => array($column['columnName'] => array('definition' => $options))));
|
||||
</td></tr>
|
||||
<tr><td>141</td>
|
||||
<td class="red"> }
|
||||
</td></tr>
|
||||
<tr><td>142</td>
|
||||
<td class="red"> }
|
||||
</td></tr>
|
||||
<tr><td>143</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>144</td>
|
||||
<td class="normal"> /**
|
||||
</td></tr>
|
||||
<tr><td>145</td>
|
||||
<td class="normal"> * processRemovedColumns
|
||||
</td></tr>
|
||||
<tr><td>146</td>
|
||||
<td class="normal"> *
|
||||
</td></tr>
|
||||
<tr><td>147</td>
|
||||
<td class="normal"> * @param string $columns
|
||||
</td></tr>
|
||||
<tr><td>148</td>
|
||||
<tr><td>134</td>
|
||||
<td class="normal"> * @return void
|
||||
</td></tr>
|
||||
<tr><td>149</td>
|
||||
<tr><td>135</td>
|
||||
<td class="normal"> */
|
||||
</td></tr>
|
||||
<tr><td>150</td>
|
||||
<td class="normal"> public function processRemovedColumns($columns)
|
||||
<tr><td>136</td>
|
||||
<td class="normal"> public function processChangedColumns($columns)
|
||||
</td></tr>
|
||||
<tr><td>151</td>
|
||||
<tr><td>137</td>
|
||||
<td class="normal"> {
|
||||
</td></tr>
|
||||
<tr><td>152</td>
|
||||
<tr><td>138</td>
|
||||
<td class="red"> foreach ($columns as $column) {
|
||||
</td></tr>
|
||||
<tr><td>153</td>
|
||||
<tr><td>139</td>
|
||||
<td class="red"> $conn = $this->getConnection($column['tableName']);
|
||||
</td></tr>
|
||||
<tr><td>154</td>
|
||||
<tr><td>140</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>141</td>
|
||||
<td class="red"> $options = array();
|
||||
</td></tr>
|
||||
<tr><td>142</td>
|
||||
<td class="red"> $options = $column['options'];
|
||||
</td></tr>
|
||||
<tr><td>143</td>
|
||||
<td class="red"> $options['type'] = $column['type'];
|
||||
</td></tr>
|
||||
<tr><td>144</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>145</td>
|
||||
<td class="red"> $conn->export->alterTable($column['tableName'], array('change' => array($column['columnName'] => array('definition' => $options))));
|
||||
</td></tr>
|
||||
<tr><td>146</td>
|
||||
<td class="red"> }
|
||||
</td></tr>
|
||||
<tr><td>147</td>
|
||||
<td class="red"> }
|
||||
</td></tr>
|
||||
<tr><td>148</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>149</td>
|
||||
<td class="normal"> /**
|
||||
</td></tr>
|
||||
<tr><td>150</td>
|
||||
<td class="normal"> * processRemovedColumns
|
||||
</td></tr>
|
||||
<tr><td>151</td>
|
||||
<td class="normal"> *
|
||||
</td></tr>
|
||||
<tr><td>152</td>
|
||||
<td class="normal"> * @param string $columns
|
||||
</td></tr>
|
||||
<tr><td>153</td>
|
||||
<td class="normal"> * @return void
|
||||
</td></tr>
|
||||
<tr><td>154</td>
|
||||
<td class="normal"> */
|
||||
</td></tr>
|
||||
<tr><td>155</td>
|
||||
<td class="red"> $conn->export->alterTable($column['tableName'], array('remove' => array($column['columnName'] => array())));
|
||||
<td class="normal"> public function processRemovedColumns($columns)
|
||||
</td></tr>
|
||||
<tr><td>156</td>
|
||||
<td class="red"> }
|
||||
<td class="normal"> {
|
||||
</td></tr>
|
||||
<tr><td>157</td>
|
||||
<td class="red"> }
|
||||
<td class="red"> foreach ($columns as $column) {
|
||||
</td></tr>
|
||||
<tr><td>158</td>
|
||||
<td class="normal">
|
||||
<td class="red"> $conn = $this->getConnection($column['tableName']);
|
||||
</td></tr>
|
||||
<tr><td>159</td>
|
||||
<td class="normal"> /**
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>160</td>
|
||||
<td class="normal"> * processAddexIndexes
|
||||
<td class="red"> $conn->export->alterTable($column['tableName'], array('remove' => array($column['columnName'] => array())));
|
||||
</td></tr>
|
||||
<tr><td>161</td>
|
||||
<td class="normal"> *
|
||||
<td class="red"> }
|
||||
</td></tr>
|
||||
<tr><td>162</td>
|
||||
<td class="normal"> * @param string $indexes
|
||||
<td class="red"> }
|
||||
</td></tr>
|
||||
<tr><td>163</td>
|
||||
<td class="normal"> * @return void
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>164</td>
|
||||
<td class="normal"> */
|
||||
<td class="normal"> /**
|
||||
</td></tr>
|
||||
<tr><td>165</td>
|
||||
<td class="normal"> public function processAddedIndexes($indexes)
|
||||
<td class="normal"> * processAddexIndexes
|
||||
</td></tr>
|
||||
<tr><td>166</td>
|
||||
<td class="normal"> {
|
||||
<td class="normal"> *
|
||||
</td></tr>
|
||||
<tr><td>167</td>
|
||||
<td class="red"> foreach ($indexes as $index) {
|
||||
</td></tr>
|
||||
<tr><td>168</td>
|
||||
<td class="red"> $conn = $this->getConnection($index['tableName']);
|
||||
</td></tr>
|
||||
<tr><td>169</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>170</td>
|
||||
<td class="red"> $conn->export->createIndex($index['tableName'], $index['indexName'], $index['definition']);
|
||||
</td></tr>
|
||||
<tr><td>171</td>
|
||||
<td class="red"> }
|
||||
</td></tr>
|
||||
<tr><td>172</td>
|
||||
<td class="red"> }
|
||||
</td></tr>
|
||||
<tr><td>173</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>174</td>
|
||||
<td class="normal"> /**
|
||||
</td></tr>
|
||||
<tr><td>175</td>
|
||||
<td class="normal"> * processRemovedIndexes
|
||||
</td></tr>
|
||||
<tr><td>176</td>
|
||||
<td class="normal"> *
|
||||
</td></tr>
|
||||
<tr><td>177</td>
|
||||
<td class="normal"> * @param string $indexes
|
||||
</td></tr>
|
||||
<tr><td>178</td>
|
||||
<tr><td>168</td>
|
||||
<td class="normal"> * @return void
|
||||
</td></tr>
|
||||
<tr><td>179</td>
|
||||
<tr><td>169</td>
|
||||
<td class="normal"> */
|
||||
</td></tr>
|
||||
<tr><td>180</td>
|
||||
<td class="normal"> public function processRemovedIndexes($indexes)
|
||||
<tr><td>170</td>
|
||||
<td class="normal"> public function processAddedIndexes($indexes)
|
||||
</td></tr>
|
||||
<tr><td>181</td>
|
||||
<tr><td>171</td>
|
||||
<td class="normal"> {
|
||||
</td></tr>
|
||||
<tr><td>182</td>
|
||||
<tr><td>172</td>
|
||||
<td class="red"> foreach ($indexes as $index) {
|
||||
</td></tr>
|
||||
<tr><td>183</td>
|
||||
<tr><td>173</td>
|
||||
<td class="red"> $conn = $this->getConnection($index['tableName']);
|
||||
</td></tr>
|
||||
<tr><td>184</td>
|
||||
<tr><td>174</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>175</td>
|
||||
<td class="red"> $conn->export->createIndex($index['tableName'], $index['indexName'], $index['definition']);
|
||||
</td></tr>
|
||||
<tr><td>176</td>
|
||||
<td class="red"> }
|
||||
</td></tr>
|
||||
<tr><td>177</td>
|
||||
<td class="red"> }
|
||||
</td></tr>
|
||||
<tr><td>178</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>179</td>
|
||||
<td class="normal"> /**
|
||||
</td></tr>
|
||||
<tr><td>180</td>
|
||||
<td class="normal"> * processRemovedIndexes
|
||||
</td></tr>
|
||||
<tr><td>181</td>
|
||||
<td class="normal"> *
|
||||
</td></tr>
|
||||
<tr><td>182</td>
|
||||
<td class="normal"> * @param string $indexes
|
||||
</td></tr>
|
||||
<tr><td>183</td>
|
||||
<td class="normal"> * @return void
|
||||
</td></tr>
|
||||
<tr><td>184</td>
|
||||
<td class="normal"> */
|
||||
</td></tr>
|
||||
<tr><td>185</td>
|
||||
<td class="red"> $conn->export->dropIndex($index['tableName'], $index['indexName']);
|
||||
<td class="normal"> public function processRemovedIndexes($indexes)
|
||||
</td></tr>
|
||||
<tr><td>186</td>
|
||||
<td class="red"> }
|
||||
<td class="normal"> {
|
||||
</td></tr>
|
||||
<tr><td>187</td>
|
||||
<td class="red"> }
|
||||
<td class="red"> foreach ($indexes as $index) {
|
||||
</td></tr>
|
||||
<tr><td>188</td>
|
||||
<td class="normal">
|
||||
<td class="red"> $conn = $this->getConnection($index['tableName']);
|
||||
</td></tr>
|
||||
<tr><td>189</td>
|
||||
<td class="normal"> /**
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>190</td>
|
||||
<td class="normal"> * processCreatedConstraints
|
||||
<td class="red"> $conn->export->dropIndex($index['tableName'], $index['indexName']);
|
||||
</td></tr>
|
||||
<tr><td>191</td>
|
||||
<td class="normal"> *
|
||||
<td class="red"> }
|
||||
</td></tr>
|
||||
<tr><td>192</td>
|
||||
<td class="normal"> * @param string $constraints
|
||||
<td class="red"> }
|
||||
</td></tr>
|
||||
<tr><td>193</td>
|
||||
<td class="normal"> * @return void
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>194</td>
|
||||
<td class="normal"> */
|
||||
<td class="normal"> /**
|
||||
</td></tr>
|
||||
<tr><td>195</td>
|
||||
<td class="normal"> public function processCreatedConstraints($constraints)
|
||||
<td class="normal"> * processCreatedConstraints
|
||||
</td></tr>
|
||||
<tr><td>196</td>
|
||||
<td class="normal"> {
|
||||
<td class="normal"> *
|
||||
</td></tr>
|
||||
<tr><td>197</td>
|
||||
<td class="red"> foreach ($constraints as $constraint) {
|
||||
</td></tr>
|
||||
<tr><td>198</td>
|
||||
<td class="red"> $conn = $this->getConnection($constraint['tableName']);
|
||||
</td></tr>
|
||||
<tr><td>199</td>
|
||||
<td class="red"> $conn->export->createConstraint($constraint['tableName'], $constraint['constraintName'],
|
||||
</td></tr>
|
||||
<tr><td>200</td>
|
||||
<td class="red"> $constraint['definition']);
|
||||
</td></tr>
|
||||
<tr><td>201</td>
|
||||
<td class="red"> }
|
||||
</td></tr>
|
||||
<tr><td>202</td>
|
||||
<td class="red"> }
|
||||
</td></tr>
|
||||
<tr><td>203</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>204</td>
|
||||
<td class="normal"> /**
|
||||
</td></tr>
|
||||
<tr><td>205</td>
|
||||
<td class="normal"> * processDroppedConstraints
|
||||
</td></tr>
|
||||
<tr><td>206</td>
|
||||
<td class="normal"> *
|
||||
</td></tr>
|
||||
<tr><td>207</td>
|
||||
<td class="normal"> * @param string $constraints
|
||||
</td></tr>
|
||||
<tr><td>208</td>
|
||||
<tr><td>198</td>
|
||||
<td class="normal"> * @return void
|
||||
</td></tr>
|
||||
<tr><td>209</td>
|
||||
<tr><td>199</td>
|
||||
<td class="normal"> */
|
||||
</td></tr>
|
||||
<tr><td>210</td>
|
||||
<td class="normal"> public function processDroppedConstraints($constraints)
|
||||
<tr><td>200</td>
|
||||
<td class="normal"> public function processCreatedConstraints($constraints)
|
||||
</td></tr>
|
||||
<tr><td>211</td>
|
||||
<tr><td>201</td>
|
||||
<td class="normal"> {
|
||||
</td></tr>
|
||||
<tr><td>212</td>
|
||||
<tr><td>202</td>
|
||||
<td class="red"> foreach ($constraints as $constraint) {
|
||||
</td></tr>
|
||||
<tr><td>213</td>
|
||||
<tr><td>203</td>
|
||||
<td class="red"> $conn = $this->getConnection($constraint['tableName']);
|
||||
</td></tr>
|
||||
<tr><td>204</td>
|
||||
<td class="red"> $conn->export->createConstraint($constraint['tableName'], $constraint['constraintName'],
|
||||
</td></tr>
|
||||
<tr><td>205</td>
|
||||
<td class="red"> $constraint['definition']);
|
||||
</td></tr>
|
||||
<tr><td>206</td>
|
||||
<td class="red"> }
|
||||
</td></tr>
|
||||
<tr><td>207</td>
|
||||
<td class="red"> }
|
||||
</td></tr>
|
||||
<tr><td>208</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>209</td>
|
||||
<td class="normal"> /**
|
||||
</td></tr>
|
||||
<tr><td>210</td>
|
||||
<td class="normal"> * processDroppedConstraints
|
||||
</td></tr>
|
||||
<tr><td>211</td>
|
||||
<td class="normal"> *
|
||||
</td></tr>
|
||||
<tr><td>212</td>
|
||||
<td class="normal"> * @param string $constraints
|
||||
</td></tr>
|
||||
<tr><td>213</td>
|
||||
<td class="normal"> * @return void
|
||||
</td></tr>
|
||||
<tr><td>214</td>
|
||||
<td class="red"> $conn->export->dropConstraint($constraint['tableName'], $constraint['constraintName'],
|
||||
<td class="normal"> */
|
||||
</td></tr>
|
||||
<tr><td>215</td>
|
||||
<td class="red"> $constraint['primary']);
|
||||
<td class="normal"> public function processDroppedConstraints($constraints)
|
||||
</td></tr>
|
||||
<tr><td>216</td>
|
||||
<td class="red"> }
|
||||
<td class="normal"> {
|
||||
</td></tr>
|
||||
<tr><td>217</td>
|
||||
<td class="red"> }
|
||||
<td class="red"> foreach ($constraints as $constraint) {
|
||||
</td></tr>
|
||||
<tr><td>218</td>
|
||||
<td class="normal">
|
||||
<td class="red"> $conn = $this->getConnection($constraint['tableName']);
|
||||
</td></tr>
|
||||
<tr><td>219</td>
|
||||
<td class="normal"> /**
|
||||
<td class="red"> $conn->export->dropConstraint($constraint['tableName'], $constraint['constraintName'],
|
||||
</td></tr>
|
||||
<tr><td>220</td>
|
||||
<td class="normal"> * processCreatedFks
|
||||
<td class="red"> $constraint['primary']);
|
||||
</td></tr>
|
||||
<tr><td>221</td>
|
||||
<td class="normal"> *
|
||||
<td class="red"> }
|
||||
</td></tr>
|
||||
<tr><td>222</td>
|
||||
<td class="normal"> * @param string $foreignKeys
|
||||
<td class="red"> }
|
||||
</td></tr>
|
||||
<tr><td>223</td>
|
||||
<td class="normal"> * @return void
|
||||
</td></tr>
|
||||
<tr><td>224</td>
|
||||
<td class="normal"> */
|
||||
</td></tr>
|
||||
<tr><td>225</td>
|
||||
<td class="normal"> public function processCreatedFks($foreignKeys)
|
||||
</td></tr>
|
||||
<tr><td>226</td>
|
||||
<td class="normal"> {
|
||||
</td></tr>
|
||||
<tr><td>227</td>
|
||||
<td class="red"> foreach ($foreignKeys as $fk) {
|
||||
</td></tr>
|
||||
<tr><td>228</td>
|
||||
<td class="red"> $conn = $this->getConnection($fk['tableName']);
|
||||
</td></tr>
|
||||
<tr><td>229</td>
|
||||
<td class="red"> $conn->export->createForeignKey($fk['tableName'], $fk['definition']);
|
||||
</td></tr>
|
||||
<tr><td>230</td>
|
||||
<td class="red"> }
|
||||
</td></tr>
|
||||
<tr><td>231</td>
|
||||
<td class="red"> }
|
||||
</td></tr>
|
||||
<tr><td>232</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>233</td>
|
||||
<tr><td>224</td>
|
||||
<td class="normal"> /**
|
||||
</td></tr>
|
||||
<tr><td>234</td>
|
||||
<td class="normal"> * processDroppedFks
|
||||
<tr><td>225</td>
|
||||
<td class="normal"> * processCreatedFks
|
||||
</td></tr>
|
||||
<tr><td>235</td>
|
||||
<tr><td>226</td>
|
||||
<td class="normal"> *
|
||||
</td></tr>
|
||||
<tr><td>236</td>
|
||||
<tr><td>227</td>
|
||||
<td class="normal"> * @param string $foreignKeys
|
||||
</td></tr>
|
||||
<tr><td>237</td>
|
||||
<tr><td>228</td>
|
||||
<td class="normal"> * @return void
|
||||
</td></tr>
|
||||
<tr><td>238</td>
|
||||
<tr><td>229</td>
|
||||
<td class="normal"> */
|
||||
</td></tr>
|
||||
<tr><td>239</td>
|
||||
<td class="normal"> public function processDroppedFks($foreignKeys)
|
||||
<tr><td>230</td>
|
||||
<td class="normal"> public function processCreatedFks($foreignKeys)
|
||||
</td></tr>
|
||||
<tr><td>240</td>
|
||||
<tr><td>231</td>
|
||||
<td class="normal"> {
|
||||
</td></tr>
|
||||
<tr><td>241</td>
|
||||
<tr><td>232</td>
|
||||
<td class="red"> foreach ($foreignKeys as $fk) {
|
||||
</td></tr>
|
||||
<tr><td>242</td>
|
||||
<tr><td>233</td>
|
||||
<td class="red"> $conn = $this->getConnection($fk['tableName']);
|
||||
</td></tr>
|
||||
<tr><td>243</td>
|
||||
<td class="red"> $conn->export->dropForeignKey($fk['tableName'], $fk['fkName']);
|
||||
<tr><td>234</td>
|
||||
<td class="red"> $conn->export->createForeignKey($fk['tableName'], $fk['definition']);
|
||||
</td></tr>
|
||||
<tr><td>244</td>
|
||||
<tr><td>235</td>
|
||||
<td class="red"> }
|
||||
</td></tr>
|
||||
<tr><td>245</td>
|
||||
<tr><td>236</td>
|
||||
<td class="red"> }
|
||||
</td></tr>
|
||||
<tr><td>237</td>
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>238</td>
|
||||
<td class="normal"> /**
|
||||
</td></tr>
|
||||
<tr><td>239</td>
|
||||
<td class="normal"> * processDroppedFks
|
||||
</td></tr>
|
||||
<tr><td>240</td>
|
||||
<td class="normal"> *
|
||||
</td></tr>
|
||||
<tr><td>241</td>
|
||||
<td class="normal"> * @param string $foreignKeys
|
||||
</td></tr>
|
||||
<tr><td>242</td>
|
||||
<td class="normal"> * @return void
|
||||
</td></tr>
|
||||
<tr><td>243</td>
|
||||
<td class="normal"> */
|
||||
</td></tr>
|
||||
<tr><td>244</td>
|
||||
<td class="normal"> public function processDroppedFks($foreignKeys)
|
||||
</td></tr>
|
||||
<tr><td>245</td>
|
||||
<td class="normal"> {
|
||||
</td></tr>
|
||||
<tr><td>246</td>
|
||||
<td class="red"> foreach ($foreignKeys as $fk) {
|
||||
</td></tr>
|
||||
<tr><td>247</td>
|
||||
<td class="red"> $conn = $this->getConnection($fk['tableName']);
|
||||
</td></tr>
|
||||
<tr><td>248</td>
|
||||
<td class="red"> $conn->export->dropForeignKey($fk['tableName'], $fk['fkName']);
|
||||
</td></tr>
|
||||
<tr><td>249</td>
|
||||
<td class="red"> }
|
||||
</td></tr>
|
||||
<tr><td>250</td>
|
||||
<td class="red"> }
|
||||
</td></tr>
|
||||
<tr><td>251</td>
|
||||
<td class="covered">}</td></tr>
|
||||
</table></body></html>
|
File diff suppressed because it is too large
Load Diff
@ -16,7 +16,7 @@
|
||||
<td class="normal">/*
|
||||
</td></tr>
|
||||
<tr><td>3</td>
|
||||
<td class="normal"> * $Id: Record.php 3079 2007-11-07 15:38:20Z romanb $
|
||||
<td class="normal"> * $Id: Record.php 3090 2007-11-08 18:54:55Z Jonathan.Wage $
|
||||
</td></tr>
|
||||
<tr><td>4</td>
|
||||
<td class="normal"> *
|
||||
@ -103,7 +103,7 @@
|
||||
<td class="normal"> * @since 1.0
|
||||
</td></tr>
|
||||
<tr><td>32</td>
|
||||
<td class="normal"> * @version $Revision: 3079 $
|
||||
<td class="normal"> * @version $Revision: 3090 $
|
||||
</td></tr>
|
||||
<tr><td>33</td>
|
||||
<td class="normal"> */
|
||||
@ -3511,7 +3511,7 @@
|
||||
<td class="covered"> foreach ($this as $column => $value) {
|
||||
</td></tr>
|
||||
<tr><td>1168</td>
|
||||
<td class="covered"> if ($value === self::$_null) {
|
||||
<td class="covered"> if ($value === self::$_null || is_object($value)) {
|
||||
</td></tr>
|
||||
<tr><td>1169</td>
|
||||
<td class="covered"> $value = null;
|
||||
@ -3577,16 +3577,16 @@
|
||||
<td class="red"> foreach ($array as $key => $value) {
|
||||
</td></tr>
|
||||
<tr><td>1190</td>
|
||||
<td class="red"> if ($this->getTable()->hasRelation($key) && $value) {
|
||||
<td class="red"> if ($this->getTable()->hasRelation($key)) {
|
||||
</td></tr>
|
||||
<tr><td>1191</td>
|
||||
<td class="red"> $this->$key->fromArray($value);
|
||||
</td></tr>
|
||||
<tr><td>1192</td>
|
||||
<td class="red"> } else if($this->getTable()->hasColumn($key) && $value) {
|
||||
<td class="red"> } else if($this->getTable()->hasColumn($key)) {
|
||||
</td></tr>
|
||||
<tr><td>1193</td>
|
||||
<td class="red"> $this->$key = $value;
|
||||
<td class="red"> $this->set($key, $value);
|
||||
</td></tr>
|
||||
<tr><td>1194</td>
|
||||
<td class="red"> }
|
||||
|
@ -3139,7 +3139,7 @@
|
||||
<td class="covered"> if (isset($this->_identityMap[$id])) {
|
||||
</td></tr>
|
||||
<tr><td>1044</td>
|
||||
<td class="red"> return false;
|
||||
<td class="covered"> return false;
|
||||
</td></tr>
|
||||
<tr><td>1045</td>
|
||||
<td class="orange"> }
|
||||
@ -4666,7 +4666,7 @@
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>1553</td>
|
||||
<td class="covered"> return $this->_options['queryParts'][$queryPart];
|
||||
<td class="red"> return $this->_options['queryParts'][$queryPart];
|
||||
</td></tr>
|
||||
<tr><td>1554</td>
|
||||
<td class="orange"> }
|
||||
|
@ -253,7 +253,7 @@
|
||||
<td class="normal">
|
||||
</td></tr>
|
||||
<tr><td>82</td>
|
||||
<td class="covered"> $this->hasMany($className . ' as Translation', array('local' => $id, 'foreign' => $id));
|
||||
<td class="covered"> $this->hasMany($className . ' as Translation', array('local' => $id[0], 'foreign' => $id[0]));
|
||||
</td></tr>
|
||||
<tr><td>83</td>
|
||||
<td class="covered"> }
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user