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

[Propel] [Generator] minor fixes in SchemaReader and QuickBuilder classe... #304

Merged
merged 1 commit into from Oct 4, 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
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) { switch ($name) {
case 'database': case 'database':
if ($this->isExternalSchema()) { if ($this->isExternalSchema()) {
$this->currentPackage = @$attributes['package']; $this->currentPackage = isset($attributes['package']) ? $attributes['package'] : null;
if (null === $this->currentPackage) { if (null === $this->currentPackage) {
$this->currentPackage = $this->defaultPackage; $this->currentPackage = $this->defaultPackage;
} }
Expand All @@ -166,16 +166,16 @@ public function startElement($parser, $name, $attributes)
} elseif ('database' === $parentTag) { } elseif ('database' === $parentTag) {
switch ($name) { switch ($name) {
case 'external-schema': case 'external-schema':
$xmlFile = @$attributes['filename']; $xmlFile = isset($attributes['filename']) ? $attributes['filename'] : null;


// 'referenceOnly' attribute is valid in the main schema XML file only, // 'referenceOnly' attribute is valid in the main schema XML file only,
// and it's ignored in the nested external-schemas // and it's ignored in the nested external-schemas
if (!$this->isExternalSchema()) { if (!$this->isExternalSchema()) {
$isForRefOnly = @$attributes['referenceOnly']; $isForRefOnly = isset($attributes['referenceOnly']) ? $attributes['referenceOnly'] : null;
$this->isForReferenceOnly = (null !== $isForRefOnly ? ('true' === strtolower($isForRefOnly)) : true); // defaults to TRUE $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); $xmlFile = realpath(dirname($this->currentXmlFile) . DIRECTORY_SEPARATOR . $xmlFile);
if (!file_exists($xmlFile)) { if (!file_exists($xmlFile)) {
throw new SchemaException(sprintf('Unknown include external "%s"', $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\ConnectionWrapper;
use Propel\Runtime\Connection\StatementInterface; use Propel\Runtime\Connection\StatementInterface;


use \PDO;

class QuickBuilder class QuickBuilder
{ {
protected $schema, $platform, $config, $database; 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); $pdo = new PdoConnection($dsn, $user, $pass);
$con = new ConnectionWrapper($pdo); $con = new ConnectionWrapper($pdo);
$con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); $con->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_WARNING);
$this->buildSQL($con); $this->buildSQL($con);
$this->buildClasses($classTargets); $this->buildClasses($classTargets);
$name = $this->getDatabase()->getName(); $name = $this->getDatabase()->getName();
Expand Down