URGENT upgrade messed up my autonav template

Permalink
this part of my autonav template no longer works since upgrading from 5.3 to 5.4!!! HELP!

if ($ni->getName() == 'calendar' || $ni->getName() == 'news') {
            $myDB = Loader::db(); 
            $calIDs = $myDB->execute(" 
               SELECT p.cID FROM Pages p 
               JOIN CollectionVersions cv ON p.cID = cv.cID 
               JOIN PageTypes pt ON p.ctID = pt.ctID 
               WHERE pt.ctHandle = 'calendar_event'
               AND cIsTemplate = 0
               AND cvDatePublic >= SYSDATE()
               AND cvIsApproved = 1
               ORDER BY cvDatePublic
               LIMIT 1
             "); 
              $eID = $calIDs->fetchRow(); 
            $eID = $eID[0];

 
andrew replied on at Permalink Reply
andrew
are you up to date with concrete 5.4.0.5? We had some autonav issues that that update should have rectified.
jhart replied on at Permalink Reply
up 2 date...

basically, before it would link to the latest (closest to today) calendar event.
jhart replied on at Permalink Reply
still haven't been able to resolve this... any clues? hints? solutions?
Remo replied on at Permalink Reply
Remo
are you using sql stmts in your template? I recommend not to use such stuff because you're working with an oop system where you have methods to access data, these methods will always work, even with a newer version...

But I don't see why it doesn't work right now. What does it return? Nothing? Wrong data? Try removing some tables and start with CollectionVersion to see if it returns any data, then add Pages, run query again, add types, run it again... You'll quickly see where the problems starts..
jhart replied on at Permalink Reply
thanks remo.

yes, this sql is in a template. i'm not very familiar with working with databases. this was recommended by another concrete5 user and was working before.

i removed this:
$eID = $eID[0];


and now it works... not sure what that did/does.
JimboJetset replied on at Permalink Reply
JimboJetset
I've just pm'd you some code but I see you have it working...

My code got rid of the exact line you posted about above and replaced it with an alternative.