I want to use objects(java style) in my PHP code after by instantiating objects after getting their properties from database and use them as objects from that point on. Does this work in PHP? If yes,where should I place my classes in the codeigniter directories?
$object=object_constructor($this->model_name->function_that_fetches_object_properties());
What you are looking for is what is called an ORM which codeigniter does not have “out of the box”.
There are some that integrate it with Doctrine, I would recommend you look at other php frameworks that have a built in ORM, one that is somewhat similar to codeigniter in approach is FuelPHP. It is approaching a stable release and has been enjoyable for me to work with.
ORM example in FuelPHP: