Closed GuySartorelli closed 5 months ago
@maxime-rainville I'm targetting 5.2
so that multi-relational has_many relations aren't completely busted with fluent on launch. Can you please approve that, given 5.2
is in a change freeze right now?
Presuming this is just a bug fix, I'm fine with it being merged post RC.
I got this error with installer
5.2.x-dev
, linkfield4.0.x-dev
, and fluent^7
.Note that the OwnerID colun is mentioned as
"LinkField_Link"."OwnerID"
, but theOwnerClass
andOwnerRelation
columns exclude the table name ("OwnerClass"
and"OwnerRelation"
respectively).The
OwnerClass
column isn't reported as problematic in the error message, onlyOwnerRelation
is - but they should both explicitly mention what table it is, since other scenarios might have joins which do makeOwnerClass
ambiguous as well.Steps to reproduce
silverstripe/installer
with5.2.x-dev
constraintsilverstripe/linkfield
with4.0.x-dev
constrainttractorcow/silverstripe-fluent
with^7
constraintAdd a
has_many
relation on thePage
class toLink
like so:Click to expand code example
```php Link::class, ]; private static $has_many = [ 'HasManyLinks' => Link::class . '.Owner', ]; private static array $owns = [ 'HasOneLink', 'HasManyLinks', ]; private static array $cascade_deletes = [ 'HasOneLink', 'HasManyLinks', ]; private static array $cascade_duplicates = [ 'HasOneLink', 'HasManyLinks', ]; public function getCMSFields() { $fields = parent::getCMSFields(); // Don't forget to remove the auto-scaffolded fields! $fields->removeByName(['HasOneLinkID', 'HasManyLinks']); $fields->addFieldsToTab( 'Root.Main', [ LinkField::create('HasOneLink'), MultiLinkField::create('HasManyLinks'), // GridField::create('HasManyLinks')->setList($this->HasManyLinks()), ] ); return $fields; } } } ```MultiLinkField
andGridField
- so it's nothing specific to linkfield per se.FluentVersionedExtension
extension to Link:PRs