Commit 60b31c7a authored by guilhermeblanco's avatar guilhermeblanco

[2.0] Implemented CLI Task Version. Added support to DECIMAL datatype.

parent eb254226
......@@ -752,18 +752,35 @@ abstract class AbstractPlatform
return $name . ' ' . $typeDecl . $charset . $default . $notnull . $unique . $check . $collation;
}
/**
* Gets the SQL snippet that declares a floating point column of arbitrary precision.
*
* @param array $columnDef
* @return string
*/
public function getDecimalTypeDeclarationSql(array $columnDef)
{
$columnDef['precision'] = ( ! isset($columnDef['precision']) || empty($columnDef['precision']))
? 10 : $columnDef['precision'];
$columnDef['scale'] = ( ! isset($columnDef['scale']) || empty($columnDef['scale']))
? 0 : $columnDef['scale'];
return 'NUMERIC(' . $columnDef['precision'] . ', ' . $columnDef['scale'] . ')';
}
/**
* Gets the SQL snippet that declares a 4 byte integer column.
*
* @param <type> $name
* @param <type> $field
* @param array $columnDef
* @return string
*/
abstract public function getIntegerTypeDeclarationSql(array $columnDef);
/**
* Gets the SQL snippet that declares an 8 byte integer column.
*
* @param array $columnDef
* @return string
*/
abstract public function getBigIntTypeDeclarationSql(array $columnDef);
......@@ -771,6 +788,7 @@ abstract class AbstractPlatform
/**
* Gets the SQL snippet that declares a 2 byte integer column.
*
* @param array $columnDef
* @return string
*/
abstract public function getSmallIntTypeDeclarationSql(array $columnDef);
......@@ -778,6 +796,7 @@ abstract class AbstractPlatform
/**
* Gets the SQL snippet that declares common properties of an integer column.
*
* @param array $columnDef
* @return string
*/
abstract protected function _getCommonIntegerTypeDeclarationSql(array $columnDef);
......
......@@ -32,8 +32,13 @@ require __DIR__ . '/DoctrineAnnotations.php';
/**
* The AnnotationDriver reads the mapping metadata from docblock annotations.
*
* @author Roman Borschel <roman@code-factory.org>
* @since 2.0
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision$
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/
class AnnotationDriver implements Driver
{
......
......@@ -26,8 +26,13 @@ use Doctrine\ORM\Mapping\ClassMetadata;
/**
* XmlDriver is a metadata driver that enables mapping through XML files.
*
* @author Roman Borschel <roman@code-factory.org>
* @since 2.0
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision$
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/
class XmlDriver extends AbstractFileDriver
{
......
......@@ -33,8 +33,13 @@ if ( ! class_exists('sfYaml', false)) {
/**
* The YamlDriver reads the mapping metadata from yaml schema files.
*
* @author Jonathan H. Wage <jonwage@gmail.com>
* @since 2.0
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 2.0
* @version $Revision$
* @author Guilherme Blanco <guilhermeblanco@hotmail.com>
* @author Jonathan Wage <jonwage@gmail.com>
* @author Roman Borschel <roman@code-factory.org>
*/
class YamlDriver extends AbstractFileDriver
{
......
......@@ -39,12 +39,15 @@ class VersionTask extends AbstractTask
*/
public function extendedHelp()
{
$this->getPrinter()->writeln('version extended help.', 'INFO');
/*$this->getPrinter()->write('version extended help' . PHP_EOL, 'HEADER');
$this->getPrinter()->write('version extended help' . PHP_EOL, 'ERROR');
$this->getPrinter()->write('version extended help' . PHP_EOL, 'INFO');
$this->getPrinter()->write('version extended help' . PHP_EOL, 'COMMENT');
$this->getPrinter()->write('version extended help' . PHP_EOL, 'NONE');*/
$printer = $this->getPrinter();
$printer->write('Task: ')->writeln('version', 'KEYWORD')
->write('Synopsis: ');
$this->_writeSynopsis($printer);
$printer->writeln('Description: Displays the current installed Doctrine version.')
->writeln('Options:')
->writeln('No available options', 'INFO');
}
/**
......@@ -52,12 +55,12 @@ class VersionTask extends AbstractTask
*/
public function basicHelp()
{
$this->getPrinter()->writeln('version', 'KEYWORD');
/*$this->getPrinter()->write('version basic help' . PHP_EOL, 'HEADER');
$this->getPrinter()->write('version basic help' . PHP_EOL, 'ERROR');
$this->getPrinter()->write('version basic help' . PHP_EOL, 'INFO');
$this->getPrinter()->write('version basic help' . PHP_EOL, 'COMMENT');
$this->getPrinter()->write('version basic help' . PHP_EOL, 'NONE');*/
$this->_writeSynopsis($this->getPrinter());
}
private function _writeSynopsis($printer)
{
$printer->writeln('version', 'KEYWORD');
}
/**
......@@ -74,11 +77,6 @@ class VersionTask extends AbstractTask
*/
public function run()
{
$this->getPrinter()->writeln('version normal flow.', 'INFO');
/*$this->getPrinter()->write('version run' . PHP_EOL, 'HEADER');
$this->getPrinter()->write('version run' . PHP_EOL, 'ERROR');
$this->getPrinter()->write('version run' . PHP_EOL, 'INFO');
$this->getPrinter()->write('version run' . PHP_EOL, 'COMMENT');
$this->getPrinter()->write('version run' . PHP_EOL, 'NONE');*/
$this->getPrinter()->writeln('You are currently running Doctrine 2.0.0 Alpha 1', 'INFO');
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment