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

[eluser]nottRobin[/eluser]
I installed PHP 5.3.2 just so I could take advantages of namespaces. Then I added "namespace Model;" to the top of my Model class.
Code:
namespace Model;
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 */
And changed the reference to it:
Code:
class Participant extends Controller {
    function index() {
        $p = new \Model\Model_participant();
        $p->get(); // No error :)
    }
}
/* End of file participant.php */
However, I get this error:
Code:
Fatal error: Class 'Model\Model_participant' not found in /path/to/application/controllers/participant.php on line 22
After much investigation I discovered that the reason for this is that the class Model_participant doesn't actually get loaded at compile-time. It somehow gets stored by DMZ until it's needed and then loaded. And DMZ thinks it's called Model_participant, not Model\Model_participant.

I don't think there's an easy solution to this so I should probably give up. If anyone does have any suggestions please go ahead and let me know Smile

Robin.


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