-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
About Replacing Core Classes! #973
Comments
You would want to extend the Router Class and not use implements that replaces the Class |
Thanks I know Creating Core System Classes , but It so simple! namespace App\Libraries;
} running error Declaration of App\Libraries\MyRoute::__construct() must be compatible with CodeIgniter\Router\RouterInterface::__construct(CodeIgniter\Router\RouteCollectionInterface $routes) How can I correct? |
Your library should be named MY_Router not MY_Route Also if you still get the error then add this to your __construct() |
Thanks!
} running error Services.php
|
This is this definition of the Router Class Try leaving the __construct() blank and call the parent::__construct() |
Sorry, I don't understand what you mean; } Can give me more detailed code? |
Aww, sorry I had the wrong project in it was CI 3 I'll switch and take a look at it now brb. |
To use one of your own system classes instead of a default one, ensure that the Autoloader can find your class, that your new class extends the appropriate interface, and modify the appropriate Service to load your class in place of the core class. |
sorry I still don't understand,
} that your new class extends the appropriate interface I just want to How can I correct? |
Then in your Class just name the method as the one in the Router Class it will then overload that one. |
sorry I still don't run,
running error |
This is a conversation that should be happening on our forum. We use github for bug tracking and work packages. |
I want to Replace \CodeIgniter\Router\Router.php Core Classes,How to operate?
Now my work is:
Myrouter.php:
namespace App\Libraries;
class Myrouter implements \CodeIgniter\Router\RouterInterface
{
Copy Router Classes And edit Variable(Actually, I just want to replace some function)
}
Services.php:
public static function routes($getShared = false)
{
if (! $getShared)
{
return new \Rcmf\Libraries\Myrouter();
}
running error
How can I correct?
The text was updated successfully, but these errors were encountered: