Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't save event to multiple sites #130

Closed
denisyilmaz opened this issue May 12, 2022 · 2 comments
Closed

Can't save event to multiple sites #130

denisyilmaz opened this issue May 12, 2022 · 2 comments
Labels
issue Something isn't working correctly

Comments

@denisyilmaz
Copy link

denisyilmaz commented May 12, 2022

Describe the bug or issue you're experiencing
We have a craft cms installation with two sites (both same language). The default calendar is setup in a way that only for one site the event gets published by default. When saving an event for the first time everything works fine.
When editing/re-saving a event in the default calendar in either of the two sites we get the following error:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'siteId' in field list is ambiguous in /app/vendor/yiisoft/yii2/db/Command.php:1302
Stack trace:
#0 /app/vendor/yiisoft/yii2/db/Command.php(1302): PDOStatement->execute()
#1 /app/vendor/yiisoft/yii2/db/Command.php(1168): yii\db\Command->internalExecute('SELECT `element...')
#2 /app/vendor/yiisoft/yii2/db/Command.php(410): yii\db\Command->queryInternal('fetchAll', NULL)
#3 /app/vendor/yiisoft/yii2/db/Query.php(330): yii\db\Command->queryAll()
#4 /app/vendor/craftcms/cms/src/db/Query.php(201): yii\db\Query->column(NULL)
#5 /app/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1689): craft\db\Query->column(NULL)
#6 /app/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1729): craft\elements\db\ElementQuery->column(NULL)
#7 /app/vendor/solspace/craft3-calendar/packages/plugin/src/Elements/Db/EventQuery.php(493): craft\elements\db\ElementQuery->ids(NULL)
#8 /app/vendor/craftcms/cms/src/services/Elements.php(2730): Solspace\Calendar\Elements\Db\EventQuery->all()
#9 /app/vendor/craftcms/cms/src/services/Elements.php(785): craft\services\Elements->_saveElementInternal(Object(Solspace\Calendar\Elements\Event), true, true, true)
#10 /app/vendor/solspace/craft3-calendar/packages/plugin/src/Services/EventsService.php(207): craft\services\Elements->saveElement(Object(Solspace\Calendar\Elements\Event), true)
#11 /app/vendor/solspace/craft3-calendar/packages/plugin/src/Controllers/EventsController.php(248): Solspace\Calendar\Services\EventsService->saveEvent(Object(Solspace\Calendar\Elements\Event))
#12 [internal function]: Solspace\Calendar\Controllers\EventsController->actionSaveEvent()
#13 /app/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#14 /app/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#15 /app/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction('save-event', Array)
#16 /app/vendor/craftcms/cms/src/web/Application.php(293): yii\base\Module->runAction('calendar/events...', Array)
#17 /app/vendor/craftcms/cms/src/web/Application.php(602): craft\web\Application->runAction('calendar/events...', Array)
#18 /app/vendor/craftcms/cms/src/web/Application.php(272): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#19 /app/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest(Object(craft\web\Request))
#20 /app/web/index.php(26): yii\base\Application->run()
#21 {main}

Next yii\db\IntegrityException: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'siteId' in field list is ambiguous
The SQL being executed was: SELECT `elements`.`id`, `siteId`
FROM (SELECT `elements`.`id` AS `elementsId`, `elements_sites`.`id` AS `elementsSitesId`, `content`.`id` AS `contentId`
FROM `elements` `elements`
INNER JOIN `calendar_events` `calendar_events` ON `calendar_events`.`id` = `elements`.`id`
INNER JOIN `elements_sites` `elements_sites` ON `elements_sites`.`elementId` = `elements`.`id`
INNER JOIN `content` `content` ON (`content`.`elementId` = `elements`.`id`) AND (`content`.`siteId` = `elements_sites`.`siteId`)
INNER JOIN `calendar_calendars` ON `calendar_calendars`.`id` = calendar_events.`calendarId`
LEFT JOIN `users` ON `users`.`id` = calendar_events.`authorId`
WHERE (`elements_sites`.`siteId`=1) AND (`elements`.`id`=1354) AND (`elements`.`archived`=FALSE) AND (`elements`.`dateDeleted` IS NULL) AND (`elements`.`draftId` IS NULL) AND (`elements`.`revisionId` IS NULL)
ORDER BY `startDate`) `subquery`
INNER JOIN `calendar_events` `calendar_events` ON `calendar_events`.`id` = `subquery`.`elementsId`
INNER JOIN `elements` `elements` ON `elements`.`id` = `subquery`.`elementsId`
INNER JOIN `elements_sites` `elements_sites` ON `elements_sites`.`id` = `subquery`.`elementsSitesId`
INNER JOIN `content` `content` ON `content`.`id` = `subquery`.`contentId`
INNER JOIN `calendar_calendars` ON `calendar_calendars`.`id` = calendar_events.`calendarId`
LEFT JOIN `users` ON `users`.`id` = calendar_events.`authorId`
ORDER BY `startDate` in /app/vendor/yiisoft/yii2/db/Schema.php:676
Stack trace:
#0 /app/vendor/yiisoft/yii2/db/Command.php(1307): yii\db\Schema->convertException(Object(PDOException), 'SELECT `element...')
#1 /app/vendor/yiisoft/yii2/db/Command.php(1168): yii\db\Command->internalExecute('SELECT `element...')
#2 /app/vendor/yiisoft/yii2/db/Command.php(410): yii\db\Command->queryInternal('fetchAll', NULL)
#3 /app/vendor/yiisoft/yii2/db/Query.php(330): yii\db\Command->queryAll()
#4 /app/vendor/craftcms/cms/src/db/Query.php(201): yii\db\Query->column(NULL)
#5 /app/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1689): craft\db\Query->column(NULL)
#6 /app/vendor/craftcms/cms/src/elements/db/ElementQuery.php(1729): craft\elements\db\ElementQuery->column(NULL)
#7 /app/vendor/solspace/craft3-calendar/packages/plugin/src/Elements/Db/EventQuery.php(493): craft\elements\db\ElementQuery->ids(NULL)
#8 /app/vendor/craftcms/cms/src/services/Elements.php(2730): Solspace\Calendar\Elements\Db\EventQuery->all()
#9 /app/vendor/craftcms/cms/src/services/Elements.php(785): craft\services\Elements->_saveElementInternal(Object(Solspace\Calendar\Elements\Event), true, true, true)
#10 /app/vendor/solspace/craft3-calendar/packages/plugin/src/Services/EventsService.php(207): craft\services\Elements->saveElement(Object(Solspace\Calendar\Elements\Event), true)
#11 /app/vendor/solspace/craft3-calendar/packages/plugin/src/Controllers/EventsController.php(248): Solspace\Calendar\Services\EventsService->saveEvent(Object(Solspace\Calendar\Elements\Event))
#12 [internal function]: Solspace\Calendar\Controllers\EventsController->actionSaveEvent()
#13 /app/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#14 /app/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#15 /app/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction('save-event', Array)
#16 /app/vendor/craftcms/cms/src/web/Application.php(293): yii\base\Module->runAction('calendar/events...', Array)
#17 /app/vendor/craftcms/cms/src/web/Application.php(602): craft\web\Application->runAction('calendar/events...', Array)
#18 /app/vendor/craftcms/cms/src/web/Application.php(272): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#19 /app/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest(Object(craft\web\Request))
#20 /app/web/index.php(26): yii\base\Application->run()
#21 {main}
Additional Information:
Array
(
    [0] => 23000
    [1] => 1052
    [2] => Column 'siteId' in field list is ambiguous
)

Craft & Plugin Info (please complete the following information):

  • Craft Version: 3.7.42
  • Calendar Version: 3.3.11
@denisyilmaz denisyilmaz added the issue Something isn't working correctly label May 12, 2022
@kjmartens
Copy link
Contributor

Sorry for the trouble @denisyilmaz.

I noticed this issue / change that was made for Craft 3.7.42:
craftcms/cms#11113

We'll check into this and see what needs to be done to address the new issue.

@kjmartens
Copy link
Contributor

This is now resolved in Calendar 3.3.12. 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue Something isn't working correctly
Development

No branches or pull requests

2 participants