1
0
mirror of synced 2024-12-13 14:56:01 +03:00
This commit is contained in:
Fabio B. Silva 2012-08-20 22:43:16 -03:00
parent 7c754e495e
commit 5f89fa4190
2 changed files with 12 additions and 11 deletions

View File

@ -81,8 +81,8 @@ class ObjectHydrator extends AbstractHydrator
private $existingCollections = array(); private $existingCollections = array();
/** /**
* @override * {@inheritdoc}
*/ */
protected function prepare() protected function prepare()
{ {

View File

@ -71,7 +71,7 @@ class Parser
* Expressions that were encountered during parsing of identifiers and expressions * Expressions that were encountered during parsing of identifiers and expressions
* and still need to be validated. * and still need to be validated.
*/ */
/** /**
* @var array * @var array
*/ */
@ -81,12 +81,12 @@ class Parser
* @var array * @var array
*/ */
private $deferredPartialObjectExpressions = array(); private $deferredPartialObjectExpressions = array();
/** /**
* @var array * @var array
*/ */
private $deferredPathExpressions = array(); private $deferredPathExpressions = array();
/** /**
* @var array * @var array
*/ */
@ -589,18 +589,19 @@ class Parser
? $AST->fromClause->identificationVariableDeclarations[0]->rangeVariableDeclaration->abstractSchemaName ? $AST->fromClause->identificationVariableDeclarations[0]->rangeVariableDeclaration->abstractSchemaName
: null; : null;
// If the namespace is not given then assumes the first from entity namespace // If the namespace is not given then assumes the first FROM entity namespace
if (strpos($className, '\\') === false && ! class_exists($className) && strpos($fromClassName, '\\') !== false) { if (strpos($className, '\\') === false && ! class_exists($className) && strpos($fromClassName, '\\') !== false) {
$namespace = substr($fromClassName, 0 , strrpos($fromClassName, '\\')); $namespace = substr($fromClassName, 0 , strrpos($fromClassName, '\\'));
$className = $namespace . '\\' . $className; $fqcn = $namespace . '\\' . $className;
if (class_exists($className)) { if (class_exists($fqcn)) {
$expression->className = $className; $expression->className = $fqcn;
$className = $fqcn;
} }
} }
if ( ! class_exists($className)) { if ( ! class_exists($className)) {
$this->semanticalError(sprintf('Class "%s" is not defined.', $expression->className), $token); $this->semanticalError(sprintf('Class "%s" is not defined.', $className), $token);
} }
$class = new \ReflectionClass($className); $class = new \ReflectionClass($className);
@ -613,7 +614,7 @@ class Parser
$this->semanticalError(sprintf('Class "%s" has not a valid contructor.', $className), $token); $this->semanticalError(sprintf('Class "%s" has not a valid contructor.', $className), $token);
} }
if ($class->getConstructor()->getNumberOfRequiredParameters() > sizeof($args)) { if ($class->getConstructor()->getNumberOfRequiredParameters() > count($args)) {
$this->semanticalError(sprintf('Number of arguments does not match with "%s" constructor declaration.', $className), $token); $this->semanticalError(sprintf('Number of arguments does not match with "%s" constructor declaration.', $className), $token);
} }
} }