• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Not a bug Styles repository getStyleCacheData() doesn't include custom fields

Affected version
2.0.0 DP 10

Arty

Well-known member
#1
I have added custom field to xf_styles table in my add-on's setup function. It is there in database.

However when using this code, custom field is not in results:
Code:
$repo = \XF::repository('XF:Style');
$styles = $repo->getStyleCacheData();
 

Arty

Well-known member
#3
Actually there is still something fishy going on. Registry doesn't seem to refresh after add-on installed or uninstalled, so I tried to do it manually in setup:

This is what I have in setup:

Code:
public function installStep1()
{
   $this->schemaManager()->alterTable('xf_style', function(Alter $table)
   {
      $table->addColumn('test', 'tinyint')->setDefault(0);
   });
   \XF::repository('XF:Style')->rebuildStyleCache();
}
public function uninstallStep1()
{
   $this->schemaManager()->alterTable('xf_style', function(Alter $table)
   {
      $table->dropColumns('test');
   });
   \XF::repository('XF:Style')->rebuildStyleCache();
}
Looks like cache is repository is refreshed first, then column is added/deleted. So after installation custom column doesn't appear in registry, but after uninstall it does.

edit: also tried
Code:
\XF::repository('XF:Style')->triggerStyleDataRebuild();
it doesn't rebuild styles list
 
Last edited: