Welcome Guest, Not a member yet? Register   Sign In
Extending existing user model
#1

(This post was last modified: 03-26-2023, 11:33 PM by krava.)

Hello
I have a problem with extending the method of existing model. 
Here is the example. The user model located in the file: /application/model/subscriptions_model.php :
Code:
class Subscriptions_model extends App_Model {
    public function __construct() {
        parent::__construct();
    }
    public function get_child_invoices($id) {
       return $child;
    }}
I'd like to extend method of the model in the new file `/application/model/my_subscriptions_model.php`.
Code:
class My_subscriptions_model extends Subscriptions_model {
    public function __construct() {
        parent::__construct();
    }
    public get_child_invoices($id) {
        return $child;
    }}
The goal is to rewrite existing method get_child_invoices  of  Subscriptions_model .
Is it possible to resolve this issue?
Or as a way to expand the subscription controller Subscriptions (/application/controllers/subscription.php) and call the another module.
Thank you.
Reply
#2

If you want to extend the CodeIgniter model, it's CI_Model not app_model.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB