@@ -214,7 +214,7 @@ public function getBeanPropertyDescriptors(): array
214
214
public function getConstructorProperties (): array
215
215
{
216
216
$ constructorProperties = array_filter ($ this ->beanPropertyDescriptors , function (AbstractBeanPropertyDescriptor $ property ) {
217
- return $ property ->isCompulsory ();
217
+ return ! $ property instanceof InheritanceReferencePropertyDescriptor && $ property ->isCompulsory ();
218
218
});
219
219
220
220
return $ constructorProperties ;
@@ -243,7 +243,7 @@ public function getPropertiesWithDefault(): array
243
243
public function getExposedProperties (): array
244
244
{
245
245
$ exposedProperties = array_filter ($ this ->beanPropertyDescriptors , function (AbstractBeanPropertyDescriptor $ property ) {
246
- return $ property ->getTable ()->getName () == $ this ->table ->getName ();
246
+ return ! $ property instanceof InheritanceReferencePropertyDescriptor && $ property ->getTable ()->getName () = == $ this ->table ->getName ();
247
247
});
248
248
249
249
return $ exposedProperties ;
@@ -269,7 +269,7 @@ private function getProperties(Table $table): array
269
269
$ localProperties = $ this ->getPropertiesForTable ($ table );
270
270
foreach ($ localProperties as $ name => $ property ) {
271
271
// We do not override properties if this is a primary key!
272
- if ($ property ->isPrimaryKey ()) {
272
+ if (! $ property instanceof InheritanceReferencePropertyDescriptor && $ property ->isPrimaryKey ()) {
273
273
continue ;
274
274
}
275
275
$ properties [$ name ] = $ property ;
@@ -292,14 +292,14 @@ private function getPropertiesForTable(Table $table): array
292
292
{
293
293
$ parentRelationship = $ this ->schemaAnalyzer ->getParentRelationship ($ table ->getName ());
294
294
if ($ parentRelationship ) {
295
- $ ignoreColumns = $ parentRelationship ->getUnquotedLocalColumns ();
295
+ $ ignoreColumns = $ parentRelationship ->getUnquotedForeignColumns ();
296
296
} else {
297
297
$ ignoreColumns = [];
298
298
}
299
299
300
300
$ beanPropertyDescriptors = [];
301
301
foreach ($ table ->getColumns () as $ column ) {
302
- if (array_search ($ column ->getName (), $ ignoreColumns) !== false ) {
302
+ if (in_array ($ column ->getName (), $ ignoreColumns, true ) ) {
303
303
continue ;
304
304
}
305
305
@@ -311,13 +311,20 @@ private function getPropertiesForTable(Table $table): array
311
311
continue 2 ;
312
312
}
313
313
}
314
+ $ propertyDescriptor = new ObjectBeanPropertyDescriptor ($ table , $ fk , $ this ->namingStrategy , $ this ->beanNamespace , $ this ->annotationParser , $ this ->registry ->getBeanForTableName ($ fk ->getForeignTableName ()));
314
315
// Check that this property is not an inheritance relationship
315
316
$ parentRelationship = $ this ->schemaAnalyzer ->getParentRelationship ($ table ->getName ());
316
- if ($ parentRelationship === $ fk ) {
317
- continue ;
317
+ if ($ parentRelationship !== null && $ parentRelationship ->getName () === $ fk ->getName ()) {
318
+ $ beanPropertyDescriptors [] = new InheritanceReferencePropertyDescriptor (
319
+ $ table ,
320
+ $ column ,
321
+ $ this ->namingStrategy ,
322
+ $ this ->annotationParser ,
323
+ $ propertyDescriptor
324
+ );
325
+ } else {
326
+ $ beanPropertyDescriptors [] = $ propertyDescriptor ;
318
327
}
319
-
320
- $ beanPropertyDescriptors [] = new ObjectBeanPropertyDescriptor ($ table , $ fk , $ this ->namingStrategy , $ this ->beanNamespace , $ this ->annotationParser , $ this ->registry ->getBeanForTableName ($ fk ->getForeignTableName ()));
321
328
} else {
322
329
$ beanPropertyDescriptors [] = new ScalarBeanPropertyDescriptor ($ table , $ column , $ this ->namingStrategy , $ this ->annotationParser );
323
330
}
0 commit comments