Skip to content

Instantly share code, notes, and snippets.

@daslicht
Created June 20, 2014 09:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daslicht/b1fd964be06c13e60766 to your computer and use it in GitHub Desktop.
Save daslicht/b1fd964be06c13e60766 to your computer and use it in GitHub Desktop.
ERROR [User Error]: Uncaught Exception: No has_one found on class 'ShipImage', the has_many relation from 'ShipPage' to 'ShipImage' requires a has_one on 'ShipImage'
IN GET /admin/pages/edit/show/23
Line 1563 in /Users/daslicht/Public/SilverStripe-cms-v3.1.5/framework/model/DataObject.php
Source
======
1554: if(array_key_exists($class, $remoteRelations)) return $remoteRelations[$class] . 'ID';
1555: }
1556:
1557: $message = "No has_one found on class '$remoteClass'";
1558: if($type == 'has_many') {
1559: // include a hint for has_many that is missing a has_one
1560: $message .= ", the has_many relation from '$this->class' to '$remoteClass'";
1561: $message .= " requires a has_one on '$remoteClass'";
1562: }
* 1563: throw new Exception($message);
1564: }
1565:
1566: /**
1567: * Returns a many-to-many component, as a ManyManyList.
1568: * @param string $componentName Name of the many-many component
1569: * @return ManyManyList The set of components
Trace
=====
DataObject->getRemoteJoinField(Images,has_many)
DataObject.php:1472
DataObject->getComponents(Images)
call_user_func_array(Array,Array)
Object.php:747
Object->__call(Images,Array)
UploadField.php:366
ShipPage->Images()
UploadField.php:366
UploadField->setValue(,ShipPage)
Form.php:1229
Form->loadDataFrom(ShipPage)
LeftAndMain.php:1225
LeftAndMain->getEditForm(23)
CMSMain.php:583
CMSMain->getEditForm()
LeftAndMain.php:1144
LeftAndMain->EditForm()
ViewableData.php:363
ViewableData->obj(EditForm,,,1)
ViewableData.php:438
ViewableData->XML_val(EditForm,,1)
call_user_func_array(Array,Array)
SSViewer.php:179
SSViewer_Scope->__call(XML_val,Array)
SSViewer.php:535
SSViewer_DataPresenter->__call(XML_val,Array)
.cache.cms.templates.Includes.CMSMain_Content.ss:92
SSViewer_DataPresenter->XML_val(EditForm,,1)
.cache.cms.templates.Includes.CMSMain_Content.ss:92
include(/private/var/tmp/silverstripe-cache-Users-daslicht-Public-SilverStripe-cms-v3.1.5/_www/.cache.cms.templates.Includes.CMSMain_Content.ss)
SSViewer.php:997
SSViewer->includeGeneratedTemplate(/var/tmp//silverstripe-cache-Users-daslicht-Public-SilverStripe-cms-v3.1.5/_www/.cache.cms.templates.Includes.CMSMain_Content.ss,CMSPageEditController,,Array,)
SSViewer.php:1064
SSViewer->process(CMSPageEditController,)
ViewableData.php:336
ViewableData->renderWith(Array)
LeftAndMain.php:582
LeftAndMain->{closure}()
call_user_func(Closure)
PjaxResponseNegotiator.php:89
PjaxResponseNegotiator->respond(SS_HTTPRequest)
LeftAndMain.php:565
LeftAndMain->show(SS_HTTPRequest)
RequestHandler.php:288
RequestHandler->handleAction(SS_HTTPRequest,show)
Controller.php:194
Controller->handleAction(SS_HTTPRequest,show)
RequestHandler.php:200
RequestHandler->handleRequest(SS_HTTPRequest,DataModel)
Controller.php:153
Controller->handleRequest(SS_HTTPRequest,DataModel)
LeftAndMain.php:441
LeftAndMain->handleRequest(SS_HTTPRequest,DataModel)
AdminRootController.php:93
AdminRootController->handleRequest(SS_HTTPRequest,DataModel)
Director.php:366
Director::handleRequest(SS_HTTPRequest,Session,DataModel)
Director.php:152
Director::direct(/admin/pages/edit/show/23,DataModel)
main.php:189
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment