Skip to content

Commit

Permalink
[Propel] [Generator] minor fixes in SchemaReader and QuickBuilder cla…
Browse files Browse the repository at this point in the history
…sses.
  • Loading branch information
Hugo Hamon committed Oct 3, 2012
1 parent 18a073e commit b61497f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/Propel/Generator/Builder/Util/SchemaReader.php
Expand Up @@ -151,7 +151,7 @@ public function startElement($parser, $name, $attributes)
switch ($name) {
case 'database':
if ($this->isExternalSchema()) {
$this->currentPackage = @$attributes['package'];
$this->currentPackage = isset($attributes['package']) ? $attributes['package'] : null;
if (null === $this->currentPackage) {
$this->currentPackage = $this->defaultPackage;
}
Expand All @@ -166,16 +166,16 @@ public function startElement($parser, $name, $attributes)
} elseif ('database' === $parentTag) {
switch ($name) {
case 'external-schema':
$xmlFile = @$attributes['filename'];
$xmlFile = isset($attributes['filename']) ? $attributes['filename'] : null;

// 'referenceOnly' attribute is valid in the main schema XML file only,
// and it's ignored in the nested external-schemas
if (!$this->isExternalSchema()) {
$isForRefOnly = @$attributes['referenceOnly'];
$isForRefOnly = isset($attributes['referenceOnly']) ? $attributes['referenceOnly'] : null;
$this->isForReferenceOnly = (null !== $isForRefOnly ? ('true' === strtolower($isForRefOnly)) : true); // defaults to TRUE
}

if ($xmlFile{0} !== '/') {
if ('/' !== $xmlFile{0}) {
$xmlFile = realpath(dirname($this->currentXmlFile) . DIRECTORY_SEPARATOR . $xmlFile);
if (!file_exists($xmlFile)) {
throw new SchemaException(sprintf('Unknown include external "%s"', $xmlFile));
Expand Down
4 changes: 1 addition & 3 deletions src/Propel/Generator/Util/QuickBuilder.php
Expand Up @@ -21,8 +21,6 @@
use Propel\Runtime\Connection\ConnectionWrapper;
use Propel\Runtime\Connection\StatementInterface;

use \PDO;

class QuickBuilder
{
protected $schema, $platform, $config, $database;
Expand Down Expand Up @@ -103,7 +101,7 @@ public function build($dsn = null, $user = null, $pass = null, $adapter = null,
}
$pdo = new PdoConnection($dsn, $user, $pass);
$con = new ConnectionWrapper($pdo);
$con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
$con->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_WARNING);
$this->buildSQL($con);
$this->buildClasses($classTargets);
$name = $this->getDatabase()->getName();
Expand Down

0 comments on commit b61497f

Please sign in to comment.