Closed muppsy007 closed 6 years ago
Hi @muppsy007, I can't reproduce this with widgets 1.3.1 and framework 3.6.4.
Are you able to provide more information to reproduce?
I'm going to close for now. Ensure you're flushing your cache when running a dev/build, i.e. add ?flush=1
in your browser or '' flush=1
in the CLI. This could cause your error.
Thanks for reporting
Hi @robbieaverill. I am using flush too.
I'm not sure what further detail you would need sorry. The above code snippet is the entirety of the class with a verbatim error message. Aside from the module itself, that's it.
Can you post the output of composer show
please?
Hi @robbieaverill. Here it is. Sorry it's SS 3.5 not 3.7.
behat/gherkin v4.4.5
betterbrief/silverstripe-googlemapfield 1.4.0
camspiers/honeypot 2.1.0
camspiers/silverstripe-loggerbridge 1.0.0
codeception/codeception 2.2.12
composer/installers v1.5.0
dnadesign/silverstripe-datedropdownselectorfield dev-master 62f6128
doctrine/instantiator 1.0.5
drewm/mailchimp-api v2.2.4
embed/embed v2.2.7
facebook/webdriver 1.5.0
filp/whoops 2.1.14
fzaninotto/faker v1.7.1
gdmedia/ss-auto-git-ignore 1.0.2
guzzlehttp/guzzle 6.3.0
guzzlehttp/promises v1.3.1
guzzlehttp/psr7 1.4.2
heyday/silverstripe-backstop 0.1.2
heyday/silverstripe-hashpath 2.0.1
jonom/focuspoint 2.4.0
jonom/silverstripe-betternavigator 2.1.0
kinglozzer/metatitle 1.0.2
littlegiant/silverstripe-batchwrite 0.3.0
littlegiant/silverstripe-catalogmanager 4.0.0
littlegiant/silverstripe-seeder 2.0.0
littlegiant/silverstripe-seo-editor 1.0.3
littlegiant/silverstripe-singlepageadmin 4.0.0
mobiledetect/mobiledetectlib 2.8.30
monolog/monolog 1.23.0
mustangostang/spyc 0.6.2
myclabs/deep-copy 1.7.0
nathancox/sortableuploadfield 1.1.0
phpdocumentor/reflection-common 1.0.1
phpdocumentor/reflection-docblock 3.3.2
phpdocumentor/type-resolver 0.4.0
phpspec/prophecy 1.7.3
phpunit/php-code-coverage 4.0.8
phpunit/php-file-iterator 1.4.5
phpunit/php-text-template 1.2.1
phpunit/php-timer 1.0.9
phpunit/php-token-stream 1.4.12
phpunit/phpunit 5.7.26
phpunit/phpunit-mock-objects 3.4.4
psr/http-message 1.0.1
psr/log 1.0.2
ryanpotter/silverstripe-cms-theme 0.5.0
sebastian/code-unit-reverse-lookup 1.0.1
sebastian/comparator 1.2.4
sebastian/diff 1.4.3
sebastian/environment 2.0.0
sebastian/exporter 2.0.0
sebastian/global-state 1.1.1
sebastian/object-enumerator 2.0.1
sebastian/recursion-context 2.0.0
sebastian/resource-operations 1.0.0
sebastian/version 2.0.1
sentry/sentry 0.21.2
sheadawson/silverstripe-dependentdropdownfield 1.0.4
sheadawson/silverstripe-linkable 1.3.7
silverstripe-australia/grouped-cms-menu 2.4.0
silverstripe/akismet 3.2.7
silverstripe/blog 2.4.9
silverstripe/cms 3.5.6
silverstripe/framework 3.5.6
silverstripe/googlesitemaps 1.5.1
silverstripe/lumberjack 1.3.3
silverstripe/reports 3.5.6
silverstripe/siteconfig 3.5.6
silverstripe/spamprotection 2.0.8
silverstripe/tagfield 1.3.2
silverstripe/widgets 1.3.1
stecman/symfony-console-completion 0.7.0
stevie-mayhew/silverstripe-svg 1.2.0
symfony/browser-kit v3.4.3
symfony/console v2.8.33
symfony/css-selector v3.4.3
symfony/debug v3.0.9
symfony/dom-crawler v3.4.3
symfony/event-dispatcher v3.4.3
symfony/finder v3.4.3
symfony/polyfill-mbstring v1.6.0
symfony/process v3.4.3
symfony/yaml v3.3.15
tijsverkoyen/akismet 1.1.0
tractorcow/silverstripe-opengraph 3.1.0
unclecheese/betterbuttons 1.3.14
unclecheese/display-logic 1.5.0
undefinedoffset/sortablegridfield 1.0.0
webmozart/assert 1.2.0
Hi @muppsy007
Generally I think @robbieaverill is looking for a step by step guide to reproduce the issue.
However thanks to your composer show
output I was able to install the correct versions, create the model as per your OP, and complete a dev/build
.
Sorry to say, I cannot reproduce the issue either.
Suggestions: It could be environmental.
alter table
or create table
?It could be other code you have making assumptions it shouldn't. Does any class refer to WidgetArea directly (or indirectly via relationship traversal)?
Steps I took:
composer create-project silverstripe/installer widgetsqlerror 3.5.6
cd widgetsqlerror/
composer require silverstripe/blog 2.4.9
composer require silverstripe/widgets 1.3.1
cat > mysite/code/MyPage.php <<MYPAGE
<?php
class MyPage extends Page
{
private static \$has_one = [
"MyWidgetArea" => "WidgetArea"
];
}
MYPAGE
framework/sake dev/build
I also checked in the browser:
Hi @robbieaverill and @NightJar. I found the cause. And it's weird.
I traced the problem to a class that has a quite far removed ancestry relationship to the above code. The ancestry/relationship looks like this:
Page
--> MyPage (The above code)
--> RegionPage
$many_many -> Tour (extends DataObjectAsPage)
$many_many TourTransport (extends DataObject)
It's code in that last class's constructor (TourTransport) that trigger that error.
public function __construct($record = null, $isSingleton = false, $model = null) {
parent::__construct($record, $isSingleton, $model);
if($transportPage = TourTransportPage::get()->first()) {
self::$base_slug = $transportPage->URLSegment . '/';
}
}
It's that call to TourTransportPage->get(). Now that class extends Page. That's about the only direct relationship it has to MyPage, where the WidgetArea is added.
All I know is if I commented out that if block, dev/build ran successfully. After that I uncommented it and ran dev/build again without issue.
I don't know. I'm sure this is confusing without seeing the complete family of code yourself. But I think we can disregard this as a module thing. Looks very specific to my code or possibly an oddity in the order of things in dev/build itself. Either way, an edge case.
Thanks for reporting back @muppsy007, it's great to hear you were able to resolve the issue! :)
I've installed the module 1.x on SS 3.6 and done a successful dev/build. Now trying to add a widget area to a child class of Page.php as follows:
When I do a dev/build after adding this, I get the following SQL error (truncated for brevity)
What have I done wrong?