Extend method SilverStripe 4

<%- if @topic_view.topic.tags.present? %>
<%= t 'js.tagging.tags' %>: <%- @topic_view.topic.tags.each do |t| %> <%= t %> <%- end %>
<% end %>

Silverstripe Version:4.5

Question: Getting an error modifying methods using extend

Hi there,

I am trying to extend a method of a class but having no luck. I am doing this as part of an upgrade from 3.7 to 4.5. In 3.7 it was working fine without using traits. Reading documentation, i used ‘Extensible’ trait. Now i am getting the following error. Checked all my method access levels. All are public but still gets this error

Fatal error : Access level to SilverStripe\Core\Extensible::defineMethods() must be public (as in class SilverStripe\View\ViewableData)

class MyOpenController extends Controller {

    use Extensible;

     private static $allowed_actions = array(
        'login',
        'logout'
    );

    public function login($data = array()) {
      //code here
      $this->extend('customFunction');
      //more code      
    }
}

I have another Extension class that has definition for this method.

class MyOpenControllerExtension extends Extension
{

    public function customFunction() {
          //some code here
    }
}

cant seem to understand why i am getting this error. Can someone please help me figure out what is wrong here.

Cheers
DR

Sorry, had a typo in my namespace. Fixed now :slight_smile: