@@ -12,11 +12,11 @@ |
||
| 12 | 12 | use Entities\Address; |
| 13 | 13 | use Entities\User; |
| 14 | 14 | |
| 15 | -$em = require_once __DIR__ . '/bootstrap.php'; |
|
| 15 | +$em = require_once __DIR__.'/bootstrap.php'; |
|
| 16 | 16 | |
| 17 | 17 | ## PUT YOUR TEST CODE BELOW |
| 18 | 18 | |
| 19 | 19 | $user = new User; |
| 20 | 20 | $address = new Address; |
| 21 | 21 | |
| 22 | -echo 'Hello World!' . PHP_EOL; |
|
| 22 | +echo 'Hello World!'.PHP_EOL; |
|
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | public function generate(EntityManager $em, $entity) |
| 36 | 36 | { |
| 37 | 37 | $conn = $em->getConnection(); |
| 38 | - $sql = 'SELECT ' . $conn->getDatabasePlatform()->getGuidExpression(); |
|
| 38 | + $sql = 'SELECT '.$conn->getDatabasePlatform()->getGuidExpression(); |
|
| 39 | 39 | |
| 40 | 40 | return $conn->query($sql)->fetchColumn(0); |
| 41 | 41 | } |
@@ -95,15 +95,15 @@ |
||
| 95 | 95 | $expressionList[] = $this->dispatch($child); |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - switch($expr->getType()) { |
|
| 98 | + switch ($expr->getType()) { |
|
| 99 | 99 | case CompositeExpression::TYPE_AND: |
| 100 | - return '(' . implode(' AND ', $expressionList) . ')'; |
|
| 100 | + return '('.implode(' AND ', $expressionList).')'; |
|
| 101 | 101 | |
| 102 | 102 | case CompositeExpression::TYPE_OR: |
| 103 | - return '(' . implode(' OR ', $expressionList) . ')'; |
|
| 103 | + return '('.implode(' OR ', $expressionList).')'; |
|
| 104 | 104 | |
| 105 | 105 | default: |
| 106 | - throw new \RuntimeException("Unknown composite " . $expr->getType()); |
|
| 106 | + throw new \RuntimeException("Unknown composite ".$expr->getType()); |
|
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | static public function matchingAssocationFieldRequiresObject($class, $associationName) |
| 30 | 30 | { |
| 31 | 31 | return new self(sprintf( |
| 32 | - "Cannot match on %s::%s with a non-object value. Matching objects by id is " . |
|
| 32 | + "Cannot match on %s::%s with a non-object value. Matching objects by id is ". |
|
| 33 | 33 | "not compatible with matching on an in-memory collection, which compares objects by reference.", |
| 34 | 34 | $class, $associationName |
| 35 | 35 | )); |
@@ -147,9 +147,9 @@ |
||
| 147 | 147 | return (bool) $persister->count($criteria); |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | - /** |
|
| 151 | - * {@inheritdoc} |
|
| 152 | - */ |
|
| 150 | + /** |
|
| 151 | + * {@inheritdoc} |
|
| 152 | + */ |
|
| 153 | 153 | public function contains(PersistentCollection $collection, $element) |
| 154 | 154 | { |
| 155 | 155 | if ( ! $this->isValidEntityState($element)) { |
@@ -217,8 +217,8 @@ discard block |
||
| 217 | 217 | $parameters[] = $identifier[$sourceClass->getFieldForColumn($joinColumn['referencedColumnName'])]; |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | - $statement = 'DELETE FROM ' . $this->quoteStrategy->getTableName($targetClass, $this->platform) |
|
| 221 | - . ' WHERE ' . implode(' = ? AND ', $columns) . ' = ?'; |
|
| 220 | + $statement = 'DELETE FROM '.$this->quoteStrategy->getTableName($targetClass, $this->platform) |
|
| 221 | + . ' WHERE '.implode(' = ? AND ', $columns).' = ?'; |
|
| 222 | 222 | |
| 223 | 223 | return $this->conn->executeUpdate($statement, $parameters); |
| 224 | 224 | } |
@@ -255,18 +255,18 @@ discard block |
||
| 255 | 255 | ]; |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | - $statement = $this->platform->getCreateTemporaryTableSnippetSQL() . ' ' . $tempTable |
|
| 259 | - . ' (' . $this->platform->getColumnDeclarationListSQL($columnDefinitions) . ')'; |
|
| 258 | + $statement = $this->platform->getCreateTemporaryTableSnippetSQL().' '.$tempTable |
|
| 259 | + . ' ('.$this->platform->getColumnDeclarationListSQL($columnDefinitions).')'; |
|
| 260 | 260 | |
| 261 | 261 | $this->conn->executeUpdate($statement); |
| 262 | 262 | |
| 263 | 263 | // 2) Build insert table records into temporary table |
| 264 | 264 | $query = $this->em->createQuery( |
| 265 | - ' SELECT t0.' . implode(', t0.', $rootClass->getIdentifierFieldNames()) |
|
| 266 | - . ' FROM ' . $targetClass->name . ' t0 WHERE t0.' . $mapping['mappedBy'] . ' = :owner' |
|
| 265 | + ' SELECT t0.'.implode(', t0.', $rootClass->getIdentifierFieldNames()) |
|
| 266 | + . ' FROM '.$targetClass->name.' t0 WHERE t0.'.$mapping['mappedBy'].' = :owner' |
|
| 267 | 267 | )->setParameter('owner', $collection->getOwner()); |
| 268 | 268 | |
| 269 | - $statement = 'INSERT INTO ' . $tempTable . ' (' . $idColumnList . ') ' . $query->getSQL(); |
|
| 269 | + $statement = 'INSERT INTO '.$tempTable.' ('.$idColumnList.') '.$query->getSQL(); |
|
| 270 | 270 | $parameters = array_values($sourceClass->getIdentifierValues($collection->getOwner())); |
| 271 | 271 | $numDeleted = $this->conn->executeUpdate($statement, $parameters); |
| 272 | 272 | |
@@ -275,8 +275,8 @@ discard block |
||
| 275 | 275 | |
| 276 | 276 | foreach (array_reverse($classNames) as $className) { |
| 277 | 277 | $tableName = $this->quoteStrategy->getTableName($this->em->getClassMetadata($className), $this->platform); |
| 278 | - $statement = 'DELETE FROM ' . $tableName . ' WHERE (' . $idColumnList . ')' |
|
| 279 | - . ' IN (SELECT ' . $idColumnList . ' FROM ' . $tempTable . ')'; |
|
| 278 | + $statement = 'DELETE FROM '.$tableName.' WHERE ('.$idColumnList.')' |
|
| 279 | + . ' IN (SELECT '.$idColumnList.' FROM '.$tempTable.')'; |
|
| 280 | 280 | |
| 281 | 281 | $this->conn->executeUpdate($statement); |
| 282 | 282 | } |
@@ -47,17 +47,17 @@ |
||
| 47 | 47 | * Get all queued inserts. |
| 48 | 48 | * |
| 49 | 49 | * @return array |
| 50 | - */ |
|
| 50 | + */ |
|
| 51 | 51 | public function getInserts(); |
| 52 | 52 | |
| 53 | - /** |
|
| 54 | - * @TODO - It should not be here. |
|
| 55 | - * But its necessary since JoinedSubclassPersister#executeInserts invoke the root persister. |
|
| 56 | - * |
|
| 57 | - * Gets the INSERT SQL used by the persister to persist a new entity. |
|
| 58 | - * |
|
| 59 | - * @return string |
|
| 60 | - */ |
|
| 53 | + /** |
|
| 54 | + * @TODO - It should not be here. |
|
| 55 | + * But its necessary since JoinedSubclassPersister#executeInserts invoke the root persister. |
|
| 56 | + * |
|
| 57 | + * Gets the INSERT SQL used by the persister to persist a new entity. |
|
| 58 | + * |
|
| 59 | + * @return string |
|
| 60 | + */ |
|
| 61 | 61 | public function getInsertSQL(); |
| 62 | 62 | |
| 63 | 63 | /** |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | $rootClass = $this->em->getClassMetadata($this->class->rootEntityName); |
| 58 | 58 | $tableAlias = $this->getSQLTableAlias($rootClass->name); |
| 59 | 59 | |
| 60 | - // Append discriminator column |
|
| 60 | + // Append discriminator column |
|
| 61 | 61 | $discrColumn = $this->class->discriminatorColumn['name']; |
| 62 | 62 | $discrColumnType = $this->class->discriminatorColumn['type']; |
| 63 | 63 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | $discrColumn = $this->class->discriminatorColumn['name']; |
| 62 | 62 | $discrColumnType = $this->class->discriminatorColumn['type']; |
| 63 | 63 | |
| 64 | - $columnList[] = $tableAlias . '.' . $discrColumn; |
|
| 64 | + $columnList[] = $tableAlias.'.'.$discrColumn; |
|
| 65 | 65 | |
| 66 | 66 | $resultColumnName = $this->platform->getSQLResultCasing($discrColumn); |
| 67 | 67 | |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | $conditionSql .= ' AND '; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - return $conditionSql . $this->getSelectConditionDiscriminatorValueSQL(); |
|
| 145 | + return $conditionSql.$this->getSelectConditionDiscriminatorValueSQL(); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | /** |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | $conditionSql .= ' AND '; |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | - return $conditionSql . $this->getSelectConditionDiscriminatorValueSQL(); |
|
| 159 | + return $conditionSql.$this->getSelectConditionDiscriminatorValueSQL(); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | /** |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | $discColumn = $this->class->discriminatorColumn['name']; |
| 181 | 181 | $tableAlias = $this->getSQLTableAlias($this->class->name); |
| 182 | 182 | |
| 183 | - return $tableAlias . '.' . $discColumn . ' IN (' . $values . ')'; |
|
| 183 | + return $tableAlias.'.'.$discColumn.' IN ('.$values.')'; |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | /** |
@@ -33,6 +33,6 @@ |
||
| 33 | 33 | */ |
| 34 | 34 | public static function noDispatchForNode($node) |
| 35 | 35 | { |
| 36 | - return new self("Double-dispatch for node " . get_class($node) . " is not supported."); |
|
| 36 | + return new self("Double-dispatch for node ".get_class($node)." is not supported."); |
|
| 37 | 37 | } |
| 38 | 38 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | foreach ($props as $name => $prop) { |
| 75 | 75 | $ident += 4; |
| 76 | 76 | $str .= str_repeat(' ', $ident) . '"' . $name . '": ' |
| 77 | - . $this->dump($prop) . ',' . PHP_EOL; |
|
| 77 | + . $this->dump($prop) . ',' . PHP_EOL; |
|
| 78 | 78 | $ident -= 4; |
| 79 | 79 | } |
| 80 | 80 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | foreach ($obj as $k => $v) { |
| 88 | 88 | $str .= PHP_EOL . str_repeat(' ', $ident) . '"' |
| 89 | - . $k . '" => ' . $this->dump($v) . ','; |
|
| 89 | + . $k . '" => ' . $this->dump($v) . ','; |
|
| 90 | 90 | $some = true; |
| 91 | 91 | } |
| 92 | 92 | |
@@ -68,32 +68,32 @@ |
||
| 68 | 68 | $str = ''; |
| 69 | 69 | |
| 70 | 70 | if ($obj instanceof Node) { |
| 71 | - $str .= get_class($obj) . '(' . PHP_EOL; |
|
| 71 | + $str .= get_class($obj).'('.PHP_EOL; |
|
| 72 | 72 | $props = get_object_vars($obj); |
| 73 | 73 | |
| 74 | 74 | foreach ($props as $name => $prop) { |
| 75 | 75 | $ident += 4; |
| 76 | - $str .= str_repeat(' ', $ident) . '"' . $name . '": ' |
|
| 77 | - . $this->dump($prop) . ',' . PHP_EOL; |
|
| 76 | + $str .= str_repeat(' ', $ident).'"'.$name.'": ' |
|
| 77 | + . $this->dump($prop).','.PHP_EOL; |
|
| 78 | 78 | $ident -= 4; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - $str .= str_repeat(' ', $ident) . ')'; |
|
| 81 | + $str .= str_repeat(' ', $ident).')'; |
|
| 82 | 82 | } else if (is_array($obj)) { |
| 83 | 83 | $ident += 4; |
| 84 | 84 | $str .= 'array('; |
| 85 | 85 | $some = false; |
| 86 | 86 | |
| 87 | 87 | foreach ($obj as $k => $v) { |
| 88 | - $str .= PHP_EOL . str_repeat(' ', $ident) . '"' |
|
| 89 | - . $k . '" => ' . $this->dump($v) . ','; |
|
| 88 | + $str .= PHP_EOL.str_repeat(' ', $ident).'"' |
|
| 89 | + . $k.'" => '.$this->dump($v).','; |
|
| 90 | 90 | $some = true; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | $ident -= 4; |
| 94 | - $str .= ($some ? PHP_EOL . str_repeat(' ', $ident) : '') . ')'; |
|
| 94 | + $str .= ($some ? PHP_EOL . str_repeat(' ', $ident) : '').')'; |
|
| 95 | 95 | } else if (is_object($obj)) { |
| 96 | - $str .= 'instanceof(' . get_class($obj) . ')'; |
|
| 96 | + $str .= 'instanceof('.get_class($obj).')'; |
|
| 97 | 97 | } else { |
| 98 | 98 | $str .= var_export($obj, true); |
| 99 | 99 | } |