@@ -230,7 +230,7 @@ public function getPropertiesWithDefault(): array
230
230
public function getExposedProperties (): array
231
231
{
232
232
$ exposedProperties = array_filter ($ this ->beanPropertyDescriptors , function (AbstractBeanPropertyDescriptor $ property ) {
233
- return $ property ->getTable ()->getName () == $ this ->table ->getName ();
233
+ return ! $ property instanceof ScalarReferencePropertyDescriptor && $ property ->getTable ()->getName () = == $ this ->table ->getName ();
234
234
});
235
235
236
236
return $ exposedProperties ;
@@ -256,7 +256,7 @@ private function getProperties(Table $table): array
256
256
$ localProperties = $ this ->getPropertiesForTable ($ table );
257
257
foreach ($ localProperties as $ name => $ property ) {
258
258
// We do not override properties if this is a primary key!
259
- if ($ property ->isPrimaryKey ()) {
259
+ if (! $ property instanceof ScalarReferencePropertyDescriptor && $ property ->isPrimaryKey ()) {
260
260
continue ;
261
261
}
262
262
$ properties [$ name ] = $ property ;
@@ -279,14 +279,14 @@ private function getPropertiesForTable(Table $table): array
279
279
{
280
280
$ parentRelationship = $ this ->schemaAnalyzer ->getParentRelationship ($ table ->getName ());
281
281
if ($ parentRelationship ) {
282
- $ ignoreColumns = $ parentRelationship ->getUnquotedLocalColumns ();
282
+ $ ignoreColumns = $ parentRelationship ->getUnquotedForeignColumns ();
283
283
} else {
284
284
$ ignoreColumns = [];
285
285
}
286
286
287
287
$ beanPropertyDescriptors = [];
288
288
foreach ($ table ->getColumns () as $ column ) {
289
- if (array_search ($ column ->getName (), $ ignoreColumns) !== false ) {
289
+ if (in_array ($ column ->getName (), $ ignoreColumns, true ) ) {
290
290
continue ;
291
291
}
292
292
@@ -300,11 +300,18 @@ private function getPropertiesForTable(Table $table): array
300
300
}
301
301
// Check that this property is not an inheritance relationship
302
302
$ parentRelationship = $ this ->schemaAnalyzer ->getParentRelationship ($ table ->getName ());
303
- if ($ parentRelationship === $ fk ) {
304
- continue ;
303
+ if ($ parentRelationship !== null && $ parentRelationship ->getName () === $ fk ->getName ()) {
304
+ $ beanPropertyDescriptors [] = new ScalarReferencePropertyDescriptor (
305
+ $ table ,
306
+ $ column ,
307
+ $ this ->namingStrategy ,
308
+ $ this ->annotationParser ,
309
+ new ScalarBeanPropertyDescriptor ($ table , $ column , $ this ->namingStrategy , $ this ->annotationParser )
310
+ );
311
+ } else {
312
+ $ beanPropertyDescriptors [] = new ObjectBeanPropertyDescriptor ($ table , $ fk , $ this ->namingStrategy , $ this ->beanNamespace , $ this ->annotationParser , $ this ->registry ->getBeanForTableName ($ fk ->getForeignTableName ()));;
305
313
}
306
314
307
- $ beanPropertyDescriptors [] = new ObjectBeanPropertyDescriptor ($ table , $ fk , $ this ->namingStrategy , $ this ->beanNamespace , $ this ->annotationParser , $ this ->registry ->getBeanForTableName ($ fk ->getForeignTableName ()));
308
315
} else {
309
316
$ beanPropertyDescriptors [] = new ScalarBeanPropertyDescriptor ($ table , $ column , $ this ->namingStrategy , $ this ->annotationParser );
310
317
}
0 commit comments