Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

DataObjectManager Module

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

extending event_calender


Reply

20 Posts   3405 Views

Avatar
Andre

25 August 2009 at 1:53am Community Member, 126 Posts

Found it in CalendarEvents.ss

Avatar
Andre

25 August 2009 at 2:41am Community Member, 126 Posts

Hi, I have to come back to my first Problem with extending the calendar Module. I updated to r70 now, but I still got the same Error.

[User Error] Couldn't run query: SELECT `CalendarDateTime`.*, `ChurchCalendarDateTime`.*, `CalendarDateTime`.ID, if(`CalendarDateTime`.ClassName,`CalendarDateTime`.ClassName,'CalendarDateTime') AS RecordClassName FROM `CalendarDateTime` LEFT JOIN `ChurchCalendarDateTime` ON `ChurchCalendarDateTime`.ID = `CalendarDateTime`.ID WHERE (CalendarID=43 AND StartDate BETWEEN '2009-08-24' AND '2010-02-24' ) AND (`CalendarDateTime`.ClassName IN ('ChurchCalendarDateTime')) ORDER BY StartDate ASC Column 'CalendarID' in where clause is ambiguous
GET /kalender/

Line 401 in /usr/www/users/kirchk/sapphire/core/model/MySQLDatabase.php
Source

392    }
393    
394    function databaseError($msg, $errorLevel = E_USER_ERROR) {
395       // try to extract and format query
396       if(preg_match('/Couldn\'t run query: ([^\|]*)\|\s*(.*)/', $msg, $matches)) {
397          $formatter = new SQLFormatter();
398          $msg = "Couldn't run query: \n" . $formatter->formatPlain($matches[1]) . "\n\n" . $matches[2];
399       }
400       
401       user_error($msg, $errorLevel);
402    }
403 }
404
405 /**
406 * A result-set from a MySQL database.
407 * @package sapphire

Trace

* Couldn't run query: SELECT `CalendarDateTime`.*, `ChurchCalendarDateTime`.*, `CalendarDateTime`.ID, if(`CalendarDateTime`.ClassName,`CalendarDateTime`.ClassName,'CalendarDateTime') AS RecordClassName FROM `CalendarDateTime` LEFT JOIN `ChurchCalendarDateTime` ON `ChurchCalendarDateTime`.ID = `CalendarDateTime`.ID WHERE (CalendarID=43 AND StartDate BETWEEN '2009-08-24' AND '2010-02-24' ) AND (`CalendarDateTime`.ClassName IN ('ChurchCalendarDateTime')) ORDER BY StartDate ASC Column 'CalendarID' in where clause is ambiguous
Line 401 of MySQLDatabase.php
* MySQLDatabase->databaseError(Couldn't run query: SELECT `CalendarDateTime`.*, `ChurchCalendarDateTime`.*, `CalendarDateTime`.ID, if(`CalendarDateTime`.ClassName,`CalendarDateTime`.ClassName,'CalendarDateTime') AS RecordClassName FROM `CalendarDateTime` LEFT JOIN `ChurchCalendarDateTime` ON `ChurchCalendarDateTime`.ID = `CalendarDateTime`.ID WHERE (CalendarID=43 AND StartDate BETWEEN '2009-08-24' AND '2010-02-24' ) AND (`CalendarDateTime`.ClassName IN ('ChurchCalendarDateTime')) ORDER BY StartDate ASC | Column 'CalendarID' in where clause is ambiguous,256)
Line 102 of MySQLDatabase.php
* MySQLDatabase->query(SELECT `CalendarDateTime`.*, `ChurchCalendarDateTime`.*, `CalendarDateTime`.ID, if(`CalendarDateTime`.ClassName,`CalendarDateTime`.ClassName,'CalendarDateTime') AS RecordClassName FROM `CalendarDateTime` LEFT JOIN `ChurchCalendarDateTime` ON `ChurchCalendarDateTime`.ID = `CalendarDateTime`.ID WHERE (CalendarID=43 AND StartDate BETWEEN '2009-08-24' AND '2010-02-24' ) AND (`CalendarDateTime`.ClassName IN ('ChurchCalendarDateTime')) ORDER BY StartDate ASC,256)
Line 120 of DB.php
* DB::query(SELECT `CalendarDateTime`.*, `ChurchCalendarDateTime`.*, `CalendarDateTime`.ID, if(`CalendarDateTime`.ClassName,`CalendarDateTime`.ClassName,'CalendarDateTime') AS RecordClassName FROM `CalendarDateTime` LEFT JOIN `ChurchCalendarDateTime` ON `ChurchCalendarDateTime`.ID = `CalendarDateTime`.ID WHERE (CalendarID=43 AND StartDate BETWEEN '2009-08-24' AND '2010-02-24' ) AND (`CalendarDateTime`.ClassName IN ('ChurchCalendarDateTime')) ORDER BY StartDate ASC)
Line 426 of SQLQuery.php
* SQLQuery->execute()
Line 2407 of DataObject.php
* DataObject->instance_get(CalendarID=43 AND StartDate BETWEEN '2009-08-24' AND '2010-02-24' ,StartDate ASC,,,DataObjectSet)
Line 2383 of DataObject.php
* DataObject::get(ChurchCalendarDateTime,CalendarID=43 AND StartDate BETWEEN '2009-08-24' AND '2010-02-24' ,StartDate ASC)
Line 346 of Calendar.php
* Calendar->Events(,sfDate,sfDate,1,,)
Line 752 of Calendar.php
* Calendar_Controller->Events()
* call_user_func_array(Array,Array)
Line 550 of ViewableData.php
* ViewableData->cachedCall(Events,,)
Line 591 of ViewableData.php
* ViewableData->hasValue(Events)
Line 82 of .cache.usr.www.users.kirchk.event_calendar.templates.Layout.Calendar.ss
* include(/usr/www/users/kirchk/silverstripe-cache/.cache.usr.www.users.kirchk.event_calendar.templates.Layout.Calendar.ss)
Line 354 of SSViewer.php
* SSViewer->process(ChurchCalendar_Controller)
Line 346 of SSViewer.php
* SSViewer->process(ChurchCalendar_Controller)
Line 175 of Controller.php
* Controller->handleAction(HTTPRequest)
Line 129 of RequestHandler.php
* RequestHandler->handleRequest(HTTPRequest)
Line 122 of Controller.php
* Controller->handleRequest(HTTPRequest)
Line 29 of ModelAsController.php
* ModelAsController->handleRequest(HTTPRequest)
Line 277 of Director.php
* Director::handleRequest(HTTPRequest,Session)
Line 121 of Director.php
* Director::direct(/kalender/)
Line 118 of main.php

I didn't changed my code of the files I already postet. Is my code realy correct?

Avatar
UncleCheese

25 August 2009 at 3:06am 4085 Posts

Looks like there was one more fix needed. Update your SVN and try again?

Avatar
Andre

25 August 2009 at 4:14am Community Member, 126 Posts

hm, the ChurchCalender Page, I added before does show a working Kalender now in the frontend, but in the backend when selecting or adding a ChurchCalendarPage there pops up a error window. This is the part I was able to copy from it.

ERROR [User Error]: Couldn't run query:
SELECT `CalendarDateTime`.*, `ChurchCalendarDateTime`.*, `CalendarDateTime`.ID, if(`CalendarDateTime`.ClassName,`CalendarDateTime`.ClassName,'CalendarDateTime') AS RecordClassName
FROM `CalendarDateTime`
LEFT JOIN `ChurchCalendarDateTime` ON `ChurchCalendarDateTime`.ID = `CalendarDateTime`.ID
WHERE ((is_announcement = 1 AND CalendarID = 47) AND (`CalendarID` = '47')) AND (`CalendarDateTime`.ClassName IN ('ChurchCalendarDateTime'))
LIMIT 0,10

Column 'CalendarID' in where clause is ambiguous
IN POST /admin/getitem?ID=47&locale=de_DE&ajax=1
Line 401 in /usr/www/users/kirchk/sapphire/core/model/MySQLDatabase.php

Source
======
392:    }
393:    
394:    function databaseError($msg, $errorLevel = E_USER_ERROR) {
395:       // try to extract and format query
396:       if(preg_match('/Couldn\'t run query: ([^\|]*)\|\s*(.*)/', $msg, $matches)) {
397:          $formatter = new SQLFormatter();
398:          $msg = "Couldn't run query: \n" . $formatter->formatPlain($matches[1]) . "\n\n" . $matches[2];
399:       }
400:       
* 401:       user_error($msg, $errorLevel);
402:    }
403: }
404:
405: /**
406: * A result-set from a MySQL database.
407: * @package sapphire

<ul>user_error(Couldn't run query:
SELECT `CalendarDateTime`.*, `ChurchCalendarDateTime`.*, `CalendarDateTime`.ID, if(`CalendarDateTime`.ClassName,`CalendarDateTime`.ClassName,'CalendarDateTime') AS RecordClassName
FROM `CalendarDateTime`
LEFT JOIN `ChurchCalendarDateTime` ON `ChurchCalendarDateTime`.ID = `CalendarDateTime`.ID
WHERE ((is_announcement = 1 AND CalendarID = 47) AND (`CalendarID` = '47')) AND (`CalendarDateTime`.ClassName IN ('ChurchCalendarDateTime'))
LIMIT 0,10

Column 'CalendarID' in where clause is ambiguous,256)
line 401 of MySQLDatabase.php

MySQLDatabase->databaseError(Couldn't run query: SELECT `CalendarDateTime`.*, `ChurchCalendarDateTime`.*, `CalendarDateTime`.ID, if(`CalendarDateTime`.ClassName,`CalendarDateTime`.ClassName,'CalendarDateTime') AS RecordClassName FROM `CalendarDateTime` LEFT JOIN `ChurchCalendarDateTime` ON `ChurchCalendarDateTime`.ID = `CalendarDateTime`.ID WHERE ((is_announcement = 1 AND CalendarID = 47) AND (`CalendarID` = '47')) AND (`CalendarDateTime`.ClassName IN ('ChurchCalendarDateTime')) LIMIT 0,10 | Column 'CalendarID' in where clause is ambiguous,256)
line 102 of MySQLDatabase.php

MySQLDatabase->query(SELECT `CalendarDateTime`.*, `ChurchCalendarDateTime`.*, `CalendarDateTime`.ID, if(`CalendarDateTime`.ClassName,`CalendarDateTime`.ClassName,'CalendarDateTime') AS RecordClassName FROM `CalendarDateTime` LEFT JOIN `ChurchCalendarDateTime` ON `ChurchCalendarDateTime`.ID = `CalendarDateTime`.ID WHERE ((is_announcement = 1 AND CalendarID = 47) AND (`CalendarID` = '47')) AND (`CalendarDateTime`.ClassName IN ('ChurchCalendarDateTime')) LIMIT 0,10,256)

Avatar
Andre

25 August 2009 at 4:25am Community Member, 126 Posts

OK, I'm now on Rev 72 with the following Error.
Fatal error: Object::add_extension() - Can't find extension class for "CalendarScriptInit" in /usr/www/users/kirchk/sapphire/core/Object.php on line 386

Avatar
UncleCheese

25 August 2009 at 5:33am 4085 Posts

That's odd. Is the file CalendarScriptInit.php in your code folder?

Avatar
Andre

25 August 2009 at 8:28pm Community Member, 126 Posts

Ok, I was to fast, so it was my fault.

The frontend is looking good, but the backend still gets the error Popup.

ERROR [User Error]: Couldn't run query:
SELECT `CalendarDateTime`.*, `ChurchCalendarDateTime`.*, `CalendarDateTime`.ID, if(`CalendarDateTime`.ClassName,`CalendarDateTime`.ClassName,'CalendarDateTime') AS RecordClassName
FROM `CalendarDateTime`
LEFT JOIN `ChurchCalendarDateTime` ON `ChurchCalendarDateTime`.ID = `CalendarDateTime`.ID
WHERE ((is_announcement = 1 AND CalendarDateTime.CalendarID = 43) AND (`CalendarID` = '43')) AND (`CalendarDateTime`.ClassName IN ('ChurchCalendarDateTime'))
LIMIT 0,10

Column 'CalendarID' in where clause is ambiguous
IN POST /admin/getitem?ID=43&ajax=1
Line 401 in /usr/www/users/kirchk/sapphire/core/model/MySQLDatabase.php

Source
======
392:    }
393:    
394:    function databaseError($msg, $errorLevel = E_USER_ERROR) {
395:       // try to extract and format query
396:       if(preg_match('/Couldn\'t run query: ([^\|]*)\|\s*(.*)/', $msg, $matches)) {
397:          $formatter = new SQLFormatter();
398:          $msg = "Couldn't run query: \n" . $formatter->formatPlain($matches[1]) . "\n\n" . $matches[2];
399:       }
400:       
* 401:       user_error($msg, $errorLevel);
402:    }
403: }
404:
405: /**
406: * A result-set from a MySQL database.
407: * @package sapphire

<ul>user_error(Couldn't run query:
SELECT `CalendarDateTime`.*, `ChurchCalendarDateTime`.*, `CalendarDateTime`.ID, if(`CalendarDateTime`.ClassName,`CalendarDateTime`.ClassName,'CalendarDateTime') AS RecordClassName
FROM `CalendarDateTime`
LEFT JOIN `ChurchCalendarDateTime` ON `ChurchCalendarDateTime`.ID = `CalendarDateTime`.ID
WHERE ((is_announcement = 1 AND CalendarDateTime.CalendarID = 43) AND (`CalendarID` = '43')) AND (`CalendarDateTime`.ClassName IN ('ChurchCalendarDateTime'))
LIMIT 0,10

Column 'CalendarID' in where clause is ambiguous,256)
line 401 of MySQLDatabase.php

MySQLDatabase->databaseError(Couldn't run query: SELECT `CalendarDateTime`.*, `ChurchCalendarDateTime`.*, `CalendarDateTime`.ID, if(`CalendarDateTime`.ClassName,`CalendarDateTime`.ClassName,'CalendarDateTime') AS RecordClassName FROM `CalendarDateTime` LEFT JOIN `ChurchCalendarDateTime` ON `ChurchCalendarDateTime`.ID = `CalendarDateTime`.ID WHERE ((is_announcement = 1 AND CalendarDateTime.CalendarID = 43) AND (`CalendarID` = '43')) AND (`CalendarDateTime`.ClassName IN ('ChurchCalendarDateTime')) LIMIT 0,10 | Column 'CalendarID' in where clause is ambiguous,256)
line 102 of MySQLDatabase.php

MySQLDatabase->query(SELECT `CalendarDateTime`.*, `ChurchCalendarDateTime`.*, `CalendarDateTime`.ID, if(`CalendarDateTime`.ClassName,`CalendarDateTime`.ClassName,'CalendarDateTime') AS RecordClassName FROM `CalendarDateTime` LEFT JOIN `ChurchCalendarDateTime` ON `ChurchCalendarDateTime`.ID = `CalendarDateTime`.ID WHERE ((is_announcement = 1 AND CalendarDateTime.CalendarID = 43) AND (`CalendarID` = '43')) AND

Avatar
Andre

25 August 2009 at 8:29pm Community Member, 126 Posts

I forgot to mention, I'm on Rev 74 now.