|
@@ -40,6 +40,10 @@ class MigrationsBase extends AbstractMigration implements ContainerAwareInterfac
|
|
|
* @var bool Me dice si tengo que mostrar los parametros en las consultas.
|
|
|
*/
|
|
|
private $showParameters = false;
|
|
|
+ /**
|
|
|
+ * @var bool Me dice si tengo que mostrar las queryies.
|
|
|
+ */
|
|
|
+ private $showQuery = true;
|
|
|
/**
|
|
|
* @var array $errorLineExecution Contiene una descripcion del error que ocaciono una linea del script YAML.
|
|
|
*/
|
|
@@ -469,6 +473,7 @@ class MigrationsBase extends AbstractMigration implements ContainerAwareInterfac
|
|
|
try {
|
|
|
$this->interpretYaml($dir, $file);
|
|
|
if (count($this->getErrorLineExecution()) > 0) {
|
|
|
+ $this->connection->rollBack();
|
|
|
//se produjeron errores
|
|
|
echo "\n\t\tSe produjeron errores de sql.\n";
|
|
|
} else {
|
|
@@ -494,7 +499,13 @@ class MigrationsBase extends AbstractMigration implements ContainerAwareInterfac
|
|
|
public function executeSQL($sql, $type, $arrayPrepare = null)
|
|
|
{
|
|
|
$this->connection->executeUpdate($sql, (array)$arrayPrepare);
|
|
|
-
|
|
|
+ if ($this->isShowQuery() && count($arrayPrepare) > 0) {
|
|
|
+ $tmp = $sql;
|
|
|
+ foreach ($arrayPrepare as $key => $value) {
|
|
|
+ $tmp = str_replace($key, $value, $tmp);
|
|
|
+ }
|
|
|
+ echo " -> $tmp";
|
|
|
+ }
|
|
|
$this->sumLine();
|
|
|
}
|
|
|
|
|
@@ -769,4 +780,20 @@ class MigrationsBase extends AbstractMigration implements ContainerAwareInterfac
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @return bool
|
|
|
+ */
|
|
|
+ public function isShowQuery()
|
|
|
+ {
|
|
|
+ return $this->showQuery;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param bool $showQuery
|
|
|
+ */
|
|
|
+ public function setShowQuery($showQuery)
|
|
|
+ {
|
|
|
+ $this->showQuery = $showQuery;
|
|
|
+ }
|
|
|
+
|
|
|
}
|