<p>I created Controller that exptends Craft <code>AssetsController</code>. Hovewer some of <code>AssetsController</code> methods are private - and I cannot use them using <code>$this</code> context in child module, so i just copied them to child module.</p>

<p>Is there any other way?</p>

CC BY-SA 4.0
2020-02-20T20:18:30.043Z
As they have a private scope, short answer is no. Extending and duping as you currently do. However, it depends on the context and what you want to achieve really, is it a new endpoint and what's the purpose? We would be able to provide better help with extra details
RoussKS
CC BY-SA 4.0
2020-02-21T07:03:07.640Z
@RoussKS - I created my own asset controller that does some specific things to uploaded file and works over ajax. And i need methods like `_requirePeerPermissionByAsset` which are private in `AssetsController`.
Piotr Pogorzelski
<plugin-development><controller><classes>
Extending Craft controller classes and using private methods in child class
# Extending Craft controller classes and using private methods in child class

(Asked by: username_0 on 2020-02-20)

I created Controller that exptends Craft `AssetsController`. Hovewer some of `AssetsController` methods are private - and I cannot use them using `$this` context in child module, so i just copied them to child module.

Is there any other way?

**Tags:** plugin-development, controller, classes

> **Comments:**
> **username_1**: As they have a private scope, short answer is no. Extending and duping as you currently do. However, it depends on the context and what you want to achieve really, is it a new endpoint and what's the purpose? We would be able to provide better help with extra details  
> **username_0**: @username_1 - I created my own asset controller that does some specific things to uploaded file and works over ajax. And i need methods like `_requirePeerPermissionByAsset` which are private in `AssetsController`.  

---

## 0 answers

