Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
Tom S. Posted June 21, 2020 Posted June 21, 2020 Hello, I'm trying to get a CMS record in a custom PHP script using: \IPS\cms\Records::loadFromSlug($id, false); But I am getting the following error: Quote BadMethodCallException: (0) #0 /applications/cms/sources/Records/Records.php(1688): IPS\Content\_Item->container() #1 /system/Patterns/ActiveRecord.php(335): IPS\cms\_Records->get__forum_record() #2 /applications/cms/sources/Records/Records.php(1547): IPS\Patterns\_ActiveRecord->__get('_forum_record') #3 /applications/cms/sources/Records/Records.php(2038): IPS\cms\_Records->__get('_forum_record') #4 /applications/cms/sources/Records/Records.php(176): IPS\cms\_Records->useForumComments() #5 /applications/cms/sources/Records/Records.php(345): IPS\cms\_Records::constructFromData(Array) The problem seems to be when this gets executed: $this->container()->forum_override I don't know what the issue could be. Any ideas?
Solution Daniel F Posted June 21, 2020 Solution Posted June 21, 2020 Don't forget that Records "doesn't exist", it's just a virtual class used to create the real implementation aka Records1, Records2 ( the Database ID is attached to the classname), this means you need to use the proper record class name. Instead of \IPS\cms\Records it's going to be \IPS\cms\Records1 ( replace 1 with your database id ) Tom S., sobrenome and DawPi 2 1
Tom S. Posted June 21, 2020 Author Posted June 21, 2020 8 minutes ago, Daniel F said: Don't forget that Records "doesn't exist", it's just a virtual class used to create the real implementation aka Records1, Records2 ( the Database ID is attached to the classname), this means you need to use the proper record class name. Instead of \IPS\cms\Records it's going to be \IPS\cms\Records1 ( replace 1 with your database id ) Thanks Daniel! Looks to be working now 🙇♂️
Recommended Posts