Welcome Guest, Not a member yet? Register   Sign In
extending libraries
#1

[eluser]stretchnate[/eluser]
is it possible to extend custom libraries from other custom libraries?

Example:
we are porting some libraries over to CI from an attempt at Zend Server (which I'm very excited about) but I'm having trouble getting a custom library that, in zend server, extended another custom library, to do the same in CI. Both files are in the /application/libraries/ folder and both are named appropriately but when I run the code I get "Class 'Companyresultobject' not found in /Applications/MAMP/htdocs/Ledger.Local/system/application/libraries/rouuid.php on line 3"

/application/libraries/Rouuid.php
Code:
class Rouuid extends Companyresultobject {
    public $uuid;

    function Rouuid($params) //$params = array($status = 0, $uuid=null, $message='')
    {
        parent::Companyresultobject();

        $debug = debug_backtrace();
        if( ! empty( $debug[0]['function'] ) ) {
            $this->method = $debug[0]['function'];
        }

        $this->status = $params['status'];
        if( isset($params['uuid']) ) {
            $this->uuid = $params['uuid'];
            $this->data = $params['uuid'];
        }

        if( ! empty($params['message']) ) {
            $this->messages[] = $params['message'];
        }
    }
}

/application/libraries/Impactresultobject.php
Code:
<?php

class Companyresultobject
{
    public $status;

    public $data;
    public $messages;
    public $method;
    
    public function Companyresultobject($status = 0, $data=null, $message='')
    {
        $debug = debug_backtrace();
        if( ! empty( $debug[0]['function'] ) ) {
            $this->method = $debug[0]['function'];
        }
        
        $this->status = $status;
        if( isset($data) ) {
            $this->data = $data;
        }
        
        if( ! empty($message) ) {
            $this->messages[] = $message;
        }
    }
    
    public function getMessageString()
    {
        return implode(", ", $this->messages);
    }


    public function __toString()
    {
        $data = get_object_vars($this);
        return print_r($data, true);
    }
    
    
}

Alternatively is it possible to create a core library that can be extended in a similar fashion?

Thanks in advance.


Messages In This Thread
extending libraries - by El Forum - 09-07-2010, 02:42 PM
extending libraries - by El Forum - 09-07-2010, 05:28 PM
extending libraries - by El Forum - 09-07-2010, 09:04 PM
extending libraries - by El Forum - 09-08-2010, 10:23 AM



Theme © iAndrew 2016 - Forum software by © MyBB