Welcome Guest, Not a member yet? Register   Sign In
DMZ - How to resolve object naming conflict?
#2

[eluser]nottRobin[/eluser]
The Model can actually be named anything, so the solution I've gone with for the time being is to prefix all my model classes with 'Model_'. It's not an ideal solution as it requires a fair bit of extra typing, and extra code, as all my relationships now have to be explicitly defined:

Code:
class Model_participant extends DataMapper {
    var $table = 'participant';
    var $has_one = array('organisation' => array('class' => 'organisation', 'other_field' => 'participant'));
}
/* End of file model_participant.php */

This then allows my controller to work fine:

Code:
class Participant extends Controller {
    function index() {
        $p = new Model_participant();
        $p->get(); // No error :)
    }
}
/* End of file participant.php */

I'd still love a more elegant solution though, so I don't have to write all the extra code.


Messages In This Thread
DMZ - How to resolve object naming conflict? - by El Forum - 03-14-2010, 04:51 PM
DMZ - How to resolve object naming conflict? - by El Forum - 03-14-2010, 06:21 PM
DMZ - How to resolve object naming conflict? - by El Forum - 03-14-2010, 06:45 PM
DMZ - How to resolve object naming conflict? - by El Forum - 03-14-2010, 07:37 PM
DMZ - How to resolve object naming conflict? - by El Forum - 03-16-2010, 11:23 PM
DMZ - How to resolve object naming conflict? - by El Forum - 03-03-2011, 12:43 PM



Theme © iAndrew 2016 - Forum software by © MyBB