How to extend class Email? |
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.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(12-23-2019, 04:22 AM)InsiteFX Wrote: 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.Please show by example how to do this?
Look at the Config/Services.php email method that will show you how to do it.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
Thanks! Everything works!
In the file \ app \ Config \ Services.php added: Code: class Services extends CoreServices File: \app\Libraries\Email.php: Code: <?php Code: $email = \Config\Services::email();
A super trivial bit of code that does not affect the outcome but is maybe an interesting alternate syntax example.
PHP Code: <?php PHP Code: <?php So the second example drops the "use" clause and defines the parent class with a fully qualified namespace instead. |
Welcome Guest, Not a member yet? Register Sign In |