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 ...@@ -752,18 +752,35 @@ abstract class AbstractPlatform
return $name . ' ' . $typeDecl . $charset . $default . $notnull . $unique . $check . $collation; 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. * Gets the SQL snippet that declares a 4 byte integer column.
* *
* @param <type> $name * @param array $columnDef
* @param <type> $field * @return string
*/ */
abstract public function getIntegerTypeDeclarationSql(array $columnDef); abstract public function getIntegerTypeDeclarationSql(array $columnDef);
/** /**
* Gets the SQL snippet that declares an 8 byte integer column. * Gets the SQL snippet that declares an 8 byte integer column.
* *
* @param array $columnDef
* @return string * @return string
*/ */
abstract public function getBigIntTypeDeclarationSql(array $columnDef); abstract public function getBigIntTypeDeclarationSql(array $columnDef);
...@@ -771,6 +788,7 @@ abstract class AbstractPlatform ...@@ -771,6 +788,7 @@ abstract class AbstractPlatform
/** /**
* Gets the SQL snippet that declares a 2 byte integer column. * Gets the SQL snippet that declares a 2 byte integer column.
* *
* @param array $columnDef
* @return string * @return string
*/ */
abstract public function getSmallIntTypeDeclarationSql(array $columnDef); abstract public function getSmallIntTypeDeclarationSql(array $columnDef);
...@@ -778,6 +796,7 @@ abstract class AbstractPlatform ...@@ -778,6 +796,7 @@ abstract class AbstractPlatform
/** /**
* Gets the SQL snippet that declares common properties of an integer column. * Gets the SQL snippet that declares common properties of an integer column.
* *
* @param array $columnDef
* @return string * @return string
*/ */
abstract protected function _getCommonIntegerTypeDeclarationSql(array $columnDef); abstract protected function _getCommonIntegerTypeDeclarationSql(array $columnDef);
......
...@@ -32,8 +32,13 @@ require __DIR__ . '/DoctrineAnnotations.php'; ...@@ -32,8 +32,13 @@ require __DIR__ . '/DoctrineAnnotations.php';
/** /**
* The AnnotationDriver reads the mapping metadata from docblock annotations. * The AnnotationDriver reads the mapping metadata from docblock annotations.
* *
* @author Roman Borschel <roman@code-factory.org> * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @since 2.0 * @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 class AnnotationDriver implements Driver
{ {
......
...@@ -26,8 +26,13 @@ use Doctrine\ORM\Mapping\ClassMetadata; ...@@ -26,8 +26,13 @@ use Doctrine\ORM\Mapping\ClassMetadata;
/** /**
* XmlDriver is a metadata driver that enables mapping through XML files. * XmlDriver is a metadata driver that enables mapping through XML files.
* *
* @author Roman Borschel <roman@code-factory.org> * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @since 2.0 * @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 class XmlDriver extends AbstractFileDriver
{ {
......
...@@ -33,8 +33,13 @@ if ( ! class_exists('sfYaml', false)) { ...@@ -33,8 +33,13 @@ if ( ! class_exists('sfYaml', false)) {
/** /**
* The YamlDriver reads the mapping metadata from yaml schema files. * The YamlDriver reads the mapping metadata from yaml schema files.
* *
* @author Jonathan H. Wage <jonwage@gmail.com> * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @since 2.0 * @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 class YamlDriver extends AbstractFileDriver
{ {
......
...@@ -39,12 +39,15 @@ class VersionTask extends AbstractTask ...@@ -39,12 +39,15 @@ class VersionTask extends AbstractTask
*/ */
public function extendedHelp() public function extendedHelp()
{ {
$this->getPrinter()->writeln('version extended help.', 'INFO'); $printer = $this->getPrinter();
/*$this->getPrinter()->write('version extended help' . PHP_EOL, 'HEADER');
$this->getPrinter()->write('version extended help' . PHP_EOL, 'ERROR'); $printer->write('Task: ')->writeln('version', 'KEYWORD')
$this->getPrinter()->write('version extended help' . PHP_EOL, 'INFO'); ->write('Synopsis: ');
$this->getPrinter()->write('version extended help' . PHP_EOL, 'COMMENT'); $this->_writeSynopsis($printer);
$this->getPrinter()->write('version extended help' . PHP_EOL, 'NONE');*/
$printer->writeln('Description: Displays the current installed Doctrine version.')
->writeln('Options:')
->writeln('No available options', 'INFO');
} }
/** /**
...@@ -52,12 +55,12 @@ class VersionTask extends AbstractTask ...@@ -52,12 +55,12 @@ class VersionTask extends AbstractTask
*/ */
public function basicHelp() public function basicHelp()
{ {
$this->getPrinter()->writeln('version', 'KEYWORD'); $this->_writeSynopsis($this->getPrinter());
/*$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'); private function _writeSynopsis($printer)
$this->getPrinter()->write('version basic help' . PHP_EOL, 'COMMENT'); {
$this->getPrinter()->write('version basic help' . PHP_EOL, 'NONE');*/ $printer->writeln('version', 'KEYWORD');
} }
/** /**
...@@ -74,11 +77,6 @@ class VersionTask extends AbstractTask ...@@ -74,11 +77,6 @@ class VersionTask extends AbstractTask
*/ */
public function run() public function run()
{ {
$this->getPrinter()->writeln('version normal flow.', 'INFO'); $this->getPrinter()->writeln('You are currently running Doctrine 2.0.0 Alpha 1', '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');*/
} }
} }
\ 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