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;
The code never dies though, what am I doing wrong?
Thanks.
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 {
Viewing 15 lines of 20 lines. View entire code block.
The code never dies though, what am I doing wrong?
Thanks.
In 5.6 you need to clear the override cache before c5 will find new overrides.
Is this different from the main cache? I have cleared this and it is no different.
Thanks.
Thanks.
Try turning off the overrides cache completely (in dashboard settings).
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.
I need to be able to clear it, and leave the cache on.
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
-Jordan
Ah right, good call - thanks. Will try.