Welcome Guest, Not a member yet? Register   Sign In
Call functions in to model..
#14

[eluser]n0xie[/eluser]
[quote author="tnathos" date="1241381608"]
I THINK WHAT CAN BE....

<?php

MODEL

FUNCTION A {
CALL FUNCTION C
delete * table b
}

FUNCTION B {
CALL FUNCTION C
delete * table a
}

FUNCTION C {
insert into table a field a, b. parametres -> post xxxxx
}

?>[/quote]
I'm guessing that you're trying to polymorphing. I hope this is what you're looking for:

Code:
<?php
/**
* Test Model
*/
class Test_model extends Model {

  function Test_model()
  {
    parent::Model();
  }

  function A($params)
  {
    $table = 'sometable';
    $this->C($params);
    $this->db->delete($table);
  }

  function B($params)
  {
    $table = 'someothertable';
    $this->C($params);
    $this->db->delete($table);
  }

  function C($params)
  {
    $table = 'yetanothertable';
    $this->db->insert($table, $params);
  }
}

/**
* Controller
*/

class Test extends Controller {

function Test(){
  parent::Controller();
  $this->load->model('test_model','test');
}

function doA()
{
  $someparams = array();
  $this->test->A($someparams);
}


function doB()
{
  $someparams = array();
  $this->test->B($someparams);
}
}

This might have typo's in it since I'm writing it from the top of my head.


Messages In This Thread
Call functions in to model.. - by El Forum - 05-02-2009, 08:09 PM
Call functions in to model.. - by El Forum - 05-03-2009, 01:56 AM
Call functions in to model.. - by El Forum - 05-03-2009, 03:55 AM
Call functions in to model.. - by El Forum - 05-03-2009, 09:13 AM
Call functions in to model.. - by El Forum - 05-03-2009, 11:06 AM
Call functions in to model.. - by El Forum - 05-03-2009, 11:23 AM
Call functions in to model.. - by El Forum - 05-03-2009, 11:25 AM
Call functions in to model.. - by El Forum - 05-03-2009, 11:27 AM
Call functions in to model.. - by El Forum - 05-03-2009, 11:31 AM
Call functions in to model.. - by El Forum - 05-03-2009, 11:48 AM
Call functions in to model.. - by El Forum - 05-03-2009, 11:59 AM
Call functions in to model.. - by El Forum - 05-03-2009, 12:26 PM
Call functions in to model.. - by El Forum - 05-04-2009, 08:05 AM
Call functions in to model.. - by El Forum - 05-04-2009, 08:38 AM
Call functions in to model.. - by El Forum - 05-04-2009, 10:10 AM
Call functions in to model.. - by El Forum - 05-04-2009, 05:16 PM



Theme © iAndrew 2016 - Forum software by © MyBB