|
@@ -87,7 +87,7 @@ discard block |
|
|
block discarded – undo |
|
87
|
87
|
*/ |
|
88
|
88
|
public function getPhpType(): string |
|
89
|
89
|
{ |
|
90
|
|
- return '\\' . $this->beanNamespace . '\\' . $this->getClassName(); |
|
|
90
|
+ return '\\'.$this->beanNamespace.'\\'.$this->getClassName(); |
|
91
|
91
|
} |
|
92
|
92
|
|
|
93
|
93
|
/** |
|
@@ -160,7 +160,7 @@ discard block |
|
|
block discarded – undo |
|
160
|
160
|
$referencedBeanName = $this->namingStrategy->getBeanClassName($this->foreignKey->getForeignTableName()); |
|
161
|
161
|
|
|
162
|
162
|
$getter = new MethodGenerator($getterName); |
|
163
|
|
- $getter->setDocBlock(new DocBlockGenerator('Returns the ' . $referencedBeanName . ' object bound to this object via the ' . implode(' and ', $this->foreignKey->getUnquotedLocalColumns()) . ' column.')); |
|
|
163
|
+ $getter->setDocBlock(new DocBlockGenerator('Returns the '.$referencedBeanName.' object bound to this object via the '.implode(' and ', $this->foreignKey->getUnquotedLocalColumns()).' column.')); |
|
164
|
164
|
|
|
165
|
165
|
/*$types = [ $referencedBeanName ]; |
|
166
|
166
|
if ($isNullable) { |
|
@@ -168,23 +168,23 @@ discard block |
|
|
block discarded – undo |
|
168
|
168
|
} |
|
169
|
169
|
$getter->getDocBlock()->setTag(new ReturnTag($types));*/ |
|
170
|
170
|
|
|
171
|
|
- $getter->setReturnType(($isNullable ? '?' : '') . $this->beanNamespace . '\\' . $referencedBeanName); |
|
|
171
|
+ $getter->setReturnType(($isNullable ? '?' : '').$this->beanNamespace.'\\'.$referencedBeanName); |
|
172
|
172
|
$tdbmFk = ForeignKey::createFromFk($this->foreignKey); |
|
173
|
173
|
|
|
174
|
|
- $getter->setBody('return $this->getRef(' . var_export($tdbmFk->getCacheKey(), true) . ', ' . var_export($tableName, true) . ');'); |
|
|
174
|
+ $getter->setBody('return $this->getRef('.var_export($tdbmFk->getCacheKey(), true).', '.var_export($tableName, true).');'); |
|
175
|
175
|
|
|
176
|
176
|
if ($this->isGetterProtected()) { |
|
177
|
177
|
$getter->setVisibility(AbstractMemberGenerator::VISIBILITY_PROTECTED); |
|
178
|
178
|
} |
|
179
|
179
|
|
|
180
|
180
|
$setter = new MethodGenerator($setterName); |
|
181
|
|
- $setter->setDocBlock(new DocBlockGenerator('The setter for the ' . $referencedBeanName . ' object bound to this object via the ' . implode(' and ', $this->foreignKey->getUnquotedLocalColumns()) . ' column.')); |
|
|
181
|
+ $setter->setDocBlock(new DocBlockGenerator('The setter for the '.$referencedBeanName.' object bound to this object via the '.implode(' and ', $this->foreignKey->getUnquotedLocalColumns()).' column.')); |
|
182
|
182
|
|
|
183
|
|
- $setter->setParameter(new ParameterGenerator('object', ($isNullable ? '?' : '') . $this->beanNamespace . '\\' . $referencedBeanName)); |
|
|
183
|
+ $setter->setParameter(new ParameterGenerator('object', ($isNullable ? '?' : '').$this->beanNamespace.'\\'.$referencedBeanName)); |
|
184
|
184
|
|
|
185
|
185
|
$setter->setReturnType('void'); |
|
186
|
186
|
|
|
187
|
|
- $setter->setBody('$this->setRef(' . var_export($tdbmFk->getCacheKey(), true) . ', $object, ' . var_export($tableName, true) . ');'); |
|
|
187
|
+ $setter->setBody('$this->setRef('.var_export($tdbmFk->getCacheKey(), true).', $object, '.var_export($tableName, true).');'); |
|
188
|
188
|
|
|
189
|
189
|
if ($this->isSetterProtected()) { |
|
190
|
190
|
$setter->setVisibility(AbstractMemberGenerator::VISIBILITY_PROTECTED); |
|
@@ -220,7 +220,7 @@ discard block |
|
|
block discarded – undo |
|
220
|
220
|
/** @var Annotation\JsonFormat|null $jsonFormat */ |
|
221
|
221
|
$jsonFormat = $this->findAnnotation(Annotation\JsonFormat::class); |
|
222
|
222
|
if ($jsonFormat !== null) { |
|
223
|
|
- $method = $jsonFormat->method ?? 'get' . ucfirst($jsonFormat->property); |
|
|
223
|
+ $method = $jsonFormat->method ?? 'get'.ucfirst($jsonFormat->property); |
|
224
|
224
|
$format = "$method()"; |
|
225
|
225
|
} else { |
|
226
|
226
|
$stopRecursion = $this->findAnnotation(Annotation\JsonRecursive::class) ? '' : 'true'; |
|
@@ -264,16 +264,16 @@ discard block |
|
|
block discarded – undo |
|
264
|
264
|
$indexName = ltrim($descriptor->getVariableName(), '$'); |
|
265
|
265
|
$columnGetterName = $descriptor->getGetterName(); |
|
266
|
266
|
if ($descriptor instanceof ObjectBeanPropertyDescriptor) { |
|
267
|
|
- $varName = '$o' . lcfirst($indexName); |
|
|
267
|
+ $varName = '$o'.lcfirst($indexName); |
|
268
|
268
|
$lazySerializeCode = $descriptor->getLazySerializeCode($varName); |
|
269
|
269
|
$rows[] = "'$indexName' => ($varName = $propertyAccess->$columnGetterName()) ? $lazySerializeCode : null"; |
|
270
|
270
|
} elseif ($descriptor instanceof ScalarBeanPropertyDescriptor) { |
|
271
|
271
|
$rows[] = "'$indexName' => $propertyAccess->$columnGetterName()"; |
|
272
|
272
|
} else { |
|
273
|
|
- throw new TDBMException('PropertyDescriptor of class `' . get_class($descriptor) . '` cannot be serialized.'); |
|
|
273
|
+ throw new TDBMException('PropertyDescriptor of class `'.get_class($descriptor).'` cannot be serialized.'); |
|
274
|
274
|
} |
|
275
|
275
|
} |
|
276
|
|
- return '[' . implode(', ', $rows) . ']'; |
|
|
276
|
+ return '['.implode(', ', $rows).']'; |
|
277
|
277
|
} |
|
278
|
278
|
|
|
279
|
279
|
private function getBeanPropertyDescriptor(string $column): AbstractBeanPropertyDescriptor |
|
@@ -286,7 +286,7 @@ discard block |
|
|
block discarded – undo |
|
286
|
286
|
return $descriptor; |
|
287
|
287
|
} |
|
288
|
288
|
} |
|
289
|
|
- throw new TDBMException('PropertyDescriptor for `'.$this->table->getName().'`.`' . $column . '` not found in `' . $this->foreignBeanDescriptor->getTable()->getName() . '`'); |
|
|
289
|
+ throw new TDBMException('PropertyDescriptor for `'.$this->table->getName().'`.`'.$column.'` not found in `'.$this->foreignBeanDescriptor->getTable()->getName().'`'); |
|
290
|
290
|
} |
|
291
|
291
|
|
|
292
|
292
|
/** |