mirror of
https://github.com/UndefinedOffset/SortableGridField.git
synced 2024-10-22 17:05:38 +02:00
Added error when a many_many relationship could not be found
This commit is contained in:
parent
b1febae3d8
commit
f6ce5741ab
@ -253,6 +253,10 @@ class GridFieldSortableRows extends AbstractGridFieldComponent implements GridFi
|
|||||||
if ($many_many) {
|
if ($many_many) {
|
||||||
$schema = Injector::inst()->get(DataObjectSchema::class);
|
$schema = Injector::inst()->get(DataObjectSchema::class);
|
||||||
$componentDetails = $schema->manyManyComponent(get_class($owner), (!empty($this->custom_relation_name) ? $this->custom_relation_name : $gridField->getName()));
|
$componentDetails = $schema->manyManyComponent(get_class($owner), (!empty($this->custom_relation_name) ? $this->custom_relation_name : $gridField->getName()));
|
||||||
|
if (empty($componentDetails)) {
|
||||||
|
user_error('Could not find the relationship "' . (!empty($this->custom_relation_name) ? $this->custom_relation_name : $gridField->getName()) . '" on "' . get_class($owner) . '"', E_USER_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
$parentField = $componentDetails['parentField'];
|
$parentField = $componentDetails['parentField'];
|
||||||
$componentField = $componentDetails['childField'];
|
$componentField = $componentDetails['childField'];
|
||||||
$table = $componentDetails['join'];
|
$table = $componentDetails['join'];
|
||||||
@ -483,6 +487,10 @@ class GridFieldSortableRows extends AbstractGridFieldComponent implements GridFi
|
|||||||
if ($many_many) {
|
if ($many_many) {
|
||||||
$schema = Injector::inst()->get(DataObjectSchema::class);
|
$schema = Injector::inst()->get(DataObjectSchema::class);
|
||||||
$componentDetails = $schema->manyManyComponent(get_class($owner), (!empty($this->custom_relation_name) ? $this->custom_relation_name : $gridField->getName()));
|
$componentDetails = $schema->manyManyComponent(get_class($owner), (!empty($this->custom_relation_name) ? $this->custom_relation_name : $gridField->getName()));
|
||||||
|
if (empty($componentDetails)) {
|
||||||
|
user_error('Could not find the relationship "' . (!empty($this->custom_relation_name) ? $this->custom_relation_name : $gridField->getName()) . '" on "' . get_class($owner) . '"', E_USER_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
$parentField = $componentDetails['parentField'];
|
$parentField = $componentDetails['parentField'];
|
||||||
$componentField = $componentDetails['childField'];
|
$componentField = $componentDetails['childField'];
|
||||||
$table = $componentDetails['join'];
|
$table = $componentDetails['join'];
|
||||||
|
Loading…
Reference in New Issue
Block a user