Overriding Models in 5.6.0.2

Permalink
Hi

I want to override some functionality of Area, so I have created a new file in /models to replace the class in /concrete/models

My class looks something like this;

class Area extends Concrete5_Model_Area
{
   /**
   * determins based on permissions what types of blocks, if any can be added to this area
   * @param Page|Collection $c
   * @param AreaPermissions
   * @return boolean|BlockTypeList
   */
   public function getAddBlockTypes(&$c, &$ap) {      
      die;
      if ($ap->canAddBlocks()) {
         $apAddBlockTypes = self::filterRestrictedTypes($ap->addBlockTypes, $ap);      
         var_dump($apAddBlockTypes);die;
         $bt = new BlockTypeList($apAddBlockTypes);      
      } else {


The code never dies though, what am I doing wrong?

Thanks.

yolk
 
JohntheFish replied on at Permalink Reply
JohntheFish
In 5.6 you need to clear the override cache before c5 will find new overrides.
yolk replied on at Permalink Reply
yolk
Is this different from the main cache? I have cleared this and it is no different.

Thanks.
jordanlev replied on at Permalink Reply
jordanlev
Try turning off the overrides cache completely (in dashboard settings).
yolk replied on at Permalink Reply
yolk
But how do you clear the cache, turning it off is not a long term solution is it?

I need to be able to clear it, and leave the cache on.
jordanlev replied on at Permalink Reply
jordanlev
I'm just suggesting you try that to see if it works or not. If it solves the problem then at least you know it's isolated to that issue. After the cache has been off for a while, you can turn it back on and presumably it will then pick up your override (like after you're done with all your coding and before you go live with it).

-Jordan
yolk replied on at Permalink Reply
yolk
Ah right, good call - thanks. Will try.