Welcome Guest, Not a member yet? Register   Sign In
models from another model and transactions
#1

[eluser]EugeneS[/eluser]
Hi,

1) in the latest CI still not possible to call models from another model ?

asking this question again (i'm sure it was discussed lot of times before) because its really required for the situations like:

adding new user and have to add transaction not completed yet into the transactions table ...

so from the model "users" i need to call model "transactions" to use method from it to add new transaction but this all wil also depend on another model "affiliates" (to take ammounts/special offers from this partner if new member registered through him)

so in fact i need to use 2 model methods from the model "users" - "transactions" and "affiliates" - to keep my business logic solid without use of controllers.. cant find in docs standard way of calling methods from methods.

2) another question even if some tricks required to use methods from other models will transactions works for the different queries from different models ?

give me sample pls how to call model from another model ... and answer pls about transactions.

Thanks.
#2

[eluser]starenka[/eluser]
you can use other models via ci instance:

Code:
$ci =& get_instance();
$ci->load->model('somewhere/myothermodel_model','it_works');
$ci->it_works->do_stuff();
#3

[eluser]EugeneS[/eluser]
[quote author="starenka" date="1269549739"]you can use other models via ci instance:

Code:
$ci =& get_instance();
$ci->load->model('somewhere/myothermodel_model','it_works');
$ci->it_works->do_stuff();
[/quote]

transactions will work ?




Theme © iAndrew 2016 - Forum software by © MyBB