| @@ 85-93 (lines=9) @@ | ||
| 82 | ->select('COUNT(*)') |
|
| 83 | ->from('(' . $query->getSQL() . ')', 'e') |
|
| 84 | ->execute(); |
|
| 85 | } else { |
|
| 86 | throw new \InvalidArgumentException( |
|
| 87 | sprintf( |
|
| 88 | 'Expected instance of Doctrine\ORM\Query' |
|
| 89 | . ' or Oro\Component\DoctrineUtils\ORM\SqlQuery, "%s" given', |
|
| 90 | is_object($query) ? get_class($query) : gettype($query) |
|
| 91 | ) |
|
| 92 | ); |
|
| 93 | } |
|
| 94 | ||
| 95 | $result = $statement->fetchColumn(); |
|
| 96 | } |
|
| @@ 85-94 (lines=10) @@ | ||
| 82 | } elseif ($value instanceof SqlQuery) { |
|
| 83 | $query = clone $value; |
|
| 84 | $query->getQueryBuilder()->setMaxResults(null)->setFirstResult(null); |
|
| 85 | } else { |
|
| 86 | throw new \InvalidArgumentException( |
|
| 87 | sprintf( |
|
| 88 | 'Expected instance of Doctrine\ORM\QueryBuilder, Doctrine\ORM\Query' |
|
| 89 | . ', Oro\Component\DoctrineUtils\ORM\SqlQueryBuilder' |
|
| 90 | . ' or Oro\Component\DoctrineUtils\ORM\SqlQuery, "%s" given', |
|
| 91 | is_object($value) ? get_class($value) : gettype($value) |
|
| 92 | ) |
|
| 93 | ); |
|
| 94 | } |
|
| 95 | } else { |
|
| 96 | $qb = $context->getController()->getManager()->getRepository()->createQueryBuilder('e'); |
|
| 97 | $query = $qb->getQuery(); |
|
| @@ 90-99 (lines=10) @@ | ||
| 87 | { |
|
| 88 | if (is_string($propertyPath)) { |
|
| 89 | $propertyPath = new PropertyPath($propertyPath); |
|
| 90 | } elseif (!$propertyPath instanceof PropertyPathInterface) { |
|
| 91 | throw new Exception\InvalidPropertyPathException( |
|
| 92 | sprintf( |
|
| 93 | 'The property path must be a string or an instance of ' . |
|
| 94 | '"Symfony\Component\PropertyAccess\PropertyPathInterface". ' . |
|
| 95 | 'Got: "%s".', |
|
| 96 | is_object($propertyPath) ? get_class($propertyPath) : gettype($propertyPath) |
|
| 97 | ) |
|
| 98 | ); |
|
| 99 | } |
|
| 100 | ||
| 101 | $path = $propertyPath->getElements(); |
|
| 102 | $values = &$this->readPropertiesUntil($object, $propertyPath, true); |
|
| @@ 167-176 (lines=10) @@ | ||
| 164 | { |
|
| 165 | if (is_string($propertyPath)) { |
|
| 166 | $propertyPath = new PropertyPath($propertyPath); |
|
| 167 | } elseif (!$propertyPath instanceof PropertyPathInterface) { |
|
| 168 | throw new Exception\InvalidPropertyPathException( |
|
| 169 | sprintf( |
|
| 170 | 'The property path must be a string or an instance of ' . |
|
| 171 | '"Symfony\Component\PropertyAccess\PropertyPathInterface". ' . |
|
| 172 | 'Got: "%s".', |
|
| 173 | is_object($propertyPath) ? get_class($propertyPath) : gettype($propertyPath) |
|
| 174 | ) |
|
| 175 | ); |
|
| 176 | } |
|
| 177 | ||
| 178 | $path = $propertyPath->getElements(); |
|
| 179 | $values = &$this->readPropertiesUntil($object, $propertyPath); |
|
| @@ 259-268 (lines=10) @@ | ||
| 256 | { |
|
| 257 | if (is_string($propertyPath)) { |
|
| 258 | $propertyPath = new PropertyPath($propertyPath); |
|
| 259 | } elseif (!$propertyPath instanceof PropertyPathInterface) { |
|
| 260 | throw new Exception\InvalidPropertyPathException( |
|
| 261 | sprintf( |
|
| 262 | 'The property path must be a string or an instance of ' . |
|
| 263 | '"Symfony\Component\PropertyAccess\PropertyPathInterface". ' . |
|
| 264 | 'Got: "%s".', |
|
| 265 | is_object($propertyPath) ? get_class($propertyPath) : gettype($propertyPath) |
|
| 266 | ) |
|
| 267 | ); |
|
| 268 | } |
|
| 269 | ||
| 270 | $path = $propertyPath->getElements(); |
|
| 271 | $length = count($path); |
|
| @@ 287-296 (lines=10) @@ | ||
| 284 | { |
|
| 285 | if (is_string($propertyPath)) { |
|
| 286 | $propertyPath = new PropertyPath($propertyPath); |
|
| 287 | } elseif (!$propertyPath instanceof PropertyPathInterface) { |
|
| 288 | throw new Exception\InvalidPropertyPathException( |
|
| 289 | sprintf( |
|
| 290 | 'The property path must be a string or an instance of ' . |
|
| 291 | '"Symfony\Component\PropertyAccess\PropertyPathInterface". ' . |
|
| 292 | 'Got: "%s".', |
|
| 293 | is_object($propertyPath) ? get_class($propertyPath) : gettype($propertyPath) |
|
| 294 | ) |
|
| 295 | ); |
|
| 296 | } |
|
| 297 | ||
| 298 | try { |
|
| 299 | $this->readPropertiesUntil( |
|
| @@ 322-331 (lines=10) @@ | ||
| 319 | { |
|
| 320 | if (is_string($propertyPath)) { |
|
| 321 | $propertyPath = new PropertyPath($propertyPath); |
|
| 322 | } elseif (!$propertyPath instanceof PropertyPathInterface) { |
|
| 323 | throw new Exception\InvalidPropertyPathException( |
|
| 324 | sprintf( |
|
| 325 | 'The property path must be a string or an instance of ' . |
|
| 326 | '"Symfony\Component\PropertyAccess\PropertyPathInterface". ' . |
|
| 327 | 'Got: "%s".', |
|
| 328 | is_object($propertyPath) ? get_class($propertyPath) : gettype($propertyPath) |
|
| 329 | ) |
|
| 330 | ); |
|
| 331 | } |
|
| 332 | ||
| 333 | try { |
|
| 334 | $propertyValues = $this->readPropertiesUntil( |
|
| @@ 126-135 (lines=10) @@ | ||
| 123 | ->getQueryBuilder() |
|
| 124 | ->setMaxResults(null) |
|
| 125 | ->setFirstResult(null); |
|
| 126 | } else { |
|
| 127 | throw new \InvalidArgumentException( |
|
| 128 | sprintf( |
|
| 129 | 'Expected instance of Doctrine\ORM\QueryBuilder, Doctrine\ORM\Query' |
|
| 130 | . ', Oro\Bundle\EntityBundle\ORM\SqlQueryBuilder' |
|
| 131 | . ' or Oro\Bundle\EntityBundle\ORM\SqlQuery, "%s" given.', |
|
| 132 | is_object($query) ? get_class($query) : gettype($query) |
|
| 133 | ) |
|
| 134 | ); |
|
| 135 | } |
|
| 136 | ||
| 137 | return QueryCountCalculator::calculateCount($countQuery); |
|
| 138 | } |
|
| @@ 63-73 (lines=11) @@ | ||
| 60 | } |
|
| 61 | } elseif ($value instanceof Constraint) { |
|
| 62 | $result[] = $value; |
|
| 63 | } else { |
|
| 64 | throw new \InvalidArgumentException( |
|
| 65 | sprintf( |
|
| 66 | 'Expected that each element in the constraints array must be either' |
|
| 67 | . ' instance of "Symfony\Component\Validator\Constraint"' |
|
| 68 | . ' or "array(constraint name => constraint options)".' |
|
| 69 | . ' Found "%s" element.', |
|
| 70 | is_object($value) ? get_class($value) : gettype($value) |
|
| 71 | ) |
|
| 72 | ); |
|
| 73 | } |
|
| 74 | } |
|
| 75 | ||
| 76 | return $result; |
|