Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strict standards fix #121

Merged
merged 6 commits into from Jan 20, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Propel/Generator/Builder/Sql/DataSQLBuilder.php
Expand Up @@ -11,6 +11,8 @@
namespace Propel\Generator\Builder\Sql;

use Propel\Generator\Builder\DataModelBuilder;
use Propel\Generator\Builder\Util\ColumnValue;
use Propel\Generator\Builder\Util\DataRow;
use Propel\Generator\Model\PropelTypes;

/**
Expand Down
Expand Up @@ -11,6 +11,8 @@
namespace Propel\Generator\Builder\Sql\Pgsql;

use Propel\Generator\Builder\Sql\DataSQLBuilder;
use Propel\Generator\Builder\Util\ColumnValue;
use Propel\Generator\Builder\Util\DataRow;

/**
* PostgreSQL class for building data dump SQL.
Expand Down Expand Up @@ -102,5 +104,4 @@ protected function getBlobSql($blob)

return "'" . pg_escape_bytea($blob) . "'";
}

}
}
37 changes: 37 additions & 0 deletions src/Propel/Generator/Builder/Util/ColumnValue.php
@@ -0,0 +1,37 @@
<?php

/**
* This file is part of the Propel package.
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @license MIT License
*/

namespace Propel\Generator\Builder\Util;

use Propel\Generator\Model\Column;

class ColumnValue
{

private $col;

private $val;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a blank line between attributes declarations.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed thanks.


public function __construct(Column $col, $val)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You missed the use statement for Column

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes! I'm updating the PR ;)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both classes are in the same namespace in fact so no need for the use statement ;)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops you're right.

{
$this->col = $col;
$this->val = $val;
}

public function getColumn()
{
return $this->col;
}

public function getValue()
{
return $this->val;
}
}
35 changes: 35 additions & 0 deletions src/Propel/Generator/Builder/Util/DataRow.php
@@ -0,0 +1,35 @@
<?php

/**
* This file is part of the Propel package.
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @license MIT License
*/

namespace Propel\Generator\Builder\Util;

use Propel\Generator\Model\Table;

class DataRow
{
private $table;
private $columnValues;

public function __construct(Table $table, $columnValues)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You missed the Table use

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use still missing here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch.

{
$this->table = $table;
$this->columnValues = $columnValues;
}

public function getTable()
{
return $this->table;
}

public function getColumnValues()
{
return $this->columnValues;
}
}
34 changes: 23 additions & 11 deletions src/Propel/Generator/Builder/Util/PropelStringReader.php
Expand Up @@ -10,7 +10,9 @@

namespace Propel\Generator\Builder\Util;

// @TODO remove
include_once 'phing/system/io/Reader.php';
use Reader;

/**
* Overrides Phing's StringReader to allow inclusin inside a BufferedReader
Expand Down Expand Up @@ -53,15 +55,16 @@ public function read($len = null)
{
if ($len === null) {
return $this->_string;
} else {
if ($this->currPos >= strlen($this->_string)) {
return -1;
}
$out = substr($this->_string, $this->currPos, $len);
$this->currPos += $len;

return $out;
}

if ($this->currPos >= strlen($this->_string)) {
return -1;
}

$out = substr($this->_string, $this->currPos, $len);
$this->currPos += $len;

return $out;
}

public function mark()
Expand All @@ -74,11 +77,20 @@ public function reset()
$this->currPos = $this->mark;
}

public function close() {}
public function close()
{

}

public function open() {}
public function open()
{

}

public function ready() {}
public function ready()
{

}

public function markSupported()
{
Expand Down
54 changes: 2 additions & 52 deletions src/Propel/Generator/Builder/Util/XmlToDataSQL.php
Expand Up @@ -17,7 +17,7 @@
*
* @author Hans Lellelid <hans@xmpl.org> (Propel)
*/
class XmlToDataSQL extends AbstractHandler
class XmlToDataSQL extends \AbstractHandler
{

/**
Expand Down Expand Up @@ -210,54 +210,4 @@ public function endElement($name)
}
}

} // XmlToData

/**
* "inner class"
*/
class DataRow
{
private $table;
private $columnValues;

public function __construct(Table $table, $columnValues)
{
$this->table = $table;
$this->columnValues = $columnValues;
}

public function getTable()
{
return $this->table;
}

public function getColumnValues()
{
return $this->columnValues;
}
}

/**
* "inner" class
*/
class ColumnValue {

private $col;
private $val;

public function __construct(Column $col, $val)
{
$this->col = $col;
$this->val = $val;
}

public function getColumn()
{
return $this->col;
}

public function getValue()
{
return $this->val;
}
}
}
16 changes: 12 additions & 4 deletions src/Propel/Generator/Model/Column.php
Expand Up @@ -10,12 +10,11 @@

namespace Propel\Generator\Model;

use DOMNode;
use DOMDocument;
use Propel\Generator\Exception\EngineException;
use Propel\Generator\Platform\PlatformInterface;

use \DOMNode;
use \DOMDocument;

/**
* A Class for holding data about a column used in an Application.
*
Expand All @@ -29,19 +28,28 @@
*/
class Column extends XmlElement
{

const DEFAULT_TYPE = "VARCHAR";

const DEFAULT_VISIBILITY = 'public';

static public $validVisibilities = array('public', 'protected', 'private');

private $name;

private $description;

private $phpName = null;

private $phpNamingMethod;

private $isNotNull = false;

private $size;

private $namePrefix;

private $accessorVisibility;

private $mutatorVisibility;

/**
Expand Down
5 changes: 2 additions & 3 deletions src/Propel/Generator/Model/Table.php
Expand Up @@ -10,12 +10,11 @@

namespace Propel\Generator\Model;

use DOMNode;
use DOMDocument;
use Propel\Generator\Exception\EngineException;
use Propel\Generator\Platform\MysqlPlatform;

use \DOMNode;
use \DOMDocument;

/**
* Data about a table used in an application.
*
Expand Down
4 changes: 2 additions & 2 deletions src/Propel/Generator/Platform/DefaultPlatform.php
Expand Up @@ -1172,7 +1172,7 @@ public function getDateFormatter()

/**
* Get the PHP snippet for binding a value to a column.
* Warning: duplicates logic from AbstractAdapter::bindValue().
* Warning: duplicates logic from AdapterInterface::bindValue().
* Any code modification here must be ported there.
*/
public function getColumnBindingPHP($column, $identifier, $columnValueAccessor, $tab = " ")
Expand Down Expand Up @@ -1202,7 +1202,7 @@ public function getColumnBindingPHP($column, $identifier, $columnValueAccessor,

/**
* Get the PHP snippet for getting a Pk from the database.
* Warning: duplicates logic from AbstractAdapter::getId().
* Warning: duplicates logic from AdapterInterface::getId().
* Any code modification here must be ported there.
*
* Typical output:
Expand Down
9 changes: 7 additions & 2 deletions src/Propel/Generator/Reverse/MssqlSchemaParser.php
Expand Up @@ -10,10 +10,15 @@

namespace Propel\Generator\Reverse;

use Propel\Generator\Model\PropelTypes;
use Propel\Generator\Reverse\AbstractSchemaParser;
// TODO: to remove
require_once 'phing/Task.php';
use Task;

use PDO;
use Propel\Generator\Model\Table;
use Propel\Generator\Model\Database;
use Propel\Generator\Model\PropelTypes;
use Propel\Generator\Reverse\AbstractSchemaParser;

/**
* Microsoft SQL Server database schema parser.
Expand Down
11 changes: 5 additions & 6 deletions src/Propel/Generator/Reverse/MysqlSchemaParser.php
Expand Up @@ -10,18 +10,17 @@

namespace Propel\Generator\Reverse;

// TODO: to remove
require_once 'phing/Task.php';
use Task;

use PDO;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I don't like such use. But only personally ;-)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally, I like to use an absolute NS for core classes :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personnaly I prefer using the following syntax for core classes:

class MyPdo extends \PDO
{
}

use Propel\Generator\Model\Column;
use Propel\Generator\Model\Database;
use Propel\Generator\Model\Table;
use Propel\Generator\Model\PropelTypes;
use Propel\Generator\Model\ColumnDefaultValue;

use \PDO;

// TODO: to remove
require_once 'phing/Task.php';
use \Task;

/**
* Mysql database schema parser.
*
Expand Down
12 changes: 8 additions & 4 deletions src/Propel/Generator/Reverse/OracleSchemaParser.php
Expand Up @@ -10,11 +10,16 @@

namespace Propel\Generator\Reverse;

// TODO: to remove
require_once 'phing/Task.php';
use Task;

use PDO;
use Propel\Generator\Model\Column;
use Propel\Generator\Model\Database;
use Propel\Generator\Model\PropelTypes;
use Propel\Generator\Reverse\AbstractSchemaParser;

use \PDO;

/**
* Oracle database schema parser.
*
Expand Down Expand Up @@ -285,5 +290,4 @@ protected function addPrimaryKey(Table $table)
}
}

}

}
10 changes: 8 additions & 2 deletions src/Propel/Generator/Reverse/PgsqlSchemaParser.php
Expand Up @@ -10,11 +10,17 @@

namespace Propel\Generator\Reverse;

// TODO: to remove
require_once 'phing/Task.php';
use Task;

use PDO;
use Propel\Generator\Model\Column;
use Propel\Generator\Model\Database;
use Propel\Generator\Model\Table;
use Propel\Generator\Model\PropelTypes;
use Propel\Generator\Reverse\AbstractSchemaParser;

use \PDO;

/**
* Postgresql database schema parser.
*
Expand Down