CodeIgniter Forums
Define methods associated to a model - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Define methods associated to a model (/showthread.php?tid=40103)



Define methods associated to a model - El Forum - 03-30-2011

[eluser]Trankh1[/eluser]
I’m using Doctrine 1.2 with CodeIgniter v1.7.X

I have a model which extends Doctrine_Record and I want to add custom
methods to this model.

Let’s take e simple example, my model has 2 fields i want to
concatenate. For that i want to create a method like that:

Code:
function concatenate() {
return $this->field1/ $this->field2;
}

Where can i put this in order to call it this way:
Code:
$object->concatenate();

Thanks