Event List breaks when using the "is_featured" attribute to sort

Permalink 3 0 Browser Info Environment
This is primarily an issue with the way that custom attributes are updated but manifests in the event list.

Steps to reproduce:
1) Create a fresh, empty install of the concrete5
2) Create a calendar
3) Create a Calendar attribute with the handle "is_featured" and the "Field available in advanced search." option unchecked.
4) Create an Event List block and check the option to only include featured events
5) Publish the page
6) See error below

If the option for "Field available in advanced search." is not checked when the attribute is created, then the field "ak_is_featured" is not created in the "CalendarEventSearchIndexAttributes" table. The Event List block checks to make sure there is an attribute called "is_featured" but not that it was created as a column. The error happens when trying to filter by this column.

Suggestions to fix this:
1) Make it clear in the Event List form, when being told to create the "is_featured" attribute, that the "Field available in advanced search." option is required.
2) When the "Field available in advanced search." option is selected later on, the "CalendarEventSearchIndexAttributes" should be updated accordingly. The table is only modified when an attribute is created and not when it is updated.

-------------------------------------------------------------
Exception Occurred: /var/www/html/concrete/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:71 An exception occurred while executing 'SELECT vo.versionOccurrenceID FROM CalendarEventVersionOccurrences vo INNER JOIN CalendarEventOccurrences eo ON vo.occurrenceID = eo.occurrenceID INNER JOIN CalendarEventVersions ve ON vo.eventVersionID = ve.eventVersionID INNER JOIN CalendarEvents e ON ve.eventID = e.eventID LEFT JOIN CalendarEventSearchIndexAttributes ea ON e.eventID = ea.eventID WHERE (eo.startTime >= ?) AND (e.caID = ?) AND (ak_is_featured = 1) AND (ve.evIsApproved = 1) ORDER BY eo.startTime, ve.evName ASC LIMIT 9 OFFSET 0' with params [1534305600, 1]:


Status: New
bleenders replied on at Permalink Reply
Same thing happens with topic filtering.

1. Created a calendar
2. Created multiple events
3. Added an event list
4. Created topics and a topic attribute for events
5. Edit the event list so it filters on topic
Result:
Doctrine\DBAL\Exception\InvalidFieldNameException thrown with message "An exception occurred while executing 'SELECT vo.versionOccurrenceID FROM CalendarEventVersionOccurrences vo INNER JOIN CalendarEventOccurrences eo ON vo.occurrenceID = eo.occurrenceID INNER JOIN CalendarEventVersions ve ON vo.eventVersionID = ve.eventVersionID INNER JOIN CalendarEvents e ON ve.eventID = e.eventID LEFT JOIN CalendarEventSearchIndexAttributes ea ON e.eventID = ea.eventID WHERE (eo.startTime >= ?) AND (e.caID = ?) AND (ak_calendar_event_type LIKE ?) AND (ve.evIsApproved = 1) ORDER BY eo.startTime, ve.evName ASC LIMIT 10 OFFSET 0' with params [1536710400, 1, "%||\/Generous%||"]:SQLSTATE[42S22]: Column not found: 1054 Unknown column 'ak_calendar_event_type' in 'where clause'"


6. Added a second topic tree to test.
7. Created the topic attribute. Made sure "Content included in search index" and "Field available in advanced search" are checked.
8. Edit an event and select topics.

Result:
An exception occurred while executing 'UPDATE CalendarEventSearchIndexAttributes SET ak_test_stuff = ? WHERE eventID = ?' with params [null, 11]: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'ak_test_stuff' in 'field list'


The same thing happens with the is_featured flag.
No matter what I do the CalendarEventSearchIndexAttributes table stays empty, no columns are being created after creating or updating events.

concrete5 Environment Information

# concrete5 Version
Core Version - 8.4.2
Version Installed - 8.4.2
Database Version - 20180716000000

# concrete5 Packages
None

# concrete5 Overrides
None

# concrete5 Cache Settings
Block Cache - On
Overrides Cache - On
Full Page Caching - Off
Full Page Cache Lifetime - Every 6 hours (default setting).

# Server Software
nginx/i-Content

# Server API
fpm-fcgi

# PHP Version
7.0.27

# PHP Extensions
bcmath, bz2, calendar, cgi-fcgi, Core, ctype, curl, date, dba, dom, enchant, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, intl, json, libxml, mbstring, mysqli, mysqlnd, openssl, pcntl, pcre, PDO, pdo_mysql, pdo_sqlite, Phar, posix, pspell, readline, Reflection, session, shmop, SimpleXML, snmp, soap, sockets, SPL, sqlite3, standard, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, wddx, xml, xmlreader, xmlrpc, xmlwriter, xsl, zip, zlib

# PHP Settings
max_execution_time - 120
log_errors_max_len - 1024
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - 300
max_input_vars - 10000
memory_limit - 256M
post_max_size - 100M
sql.safe_mode - Off
upload_max_filesize - 100M
mysqli.max_links - Unlimited
mysqli.max_persistent - Unlimited
pcre.backtrack_limit - 1000000
pcre.recursion_limit - 100000
session.cache_limiter - <i>no value</i>
session.gc_maxlifetime - 7200
soap.wsdl_cache_limit - 5

Browser User-Agent String

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36