Simplest way to extend doctrine for MVC Models

Posted by RobertPitt on Stack Overflow See other posts from Stack Overflow or by RobertPitt
Published on 2010-12-29T23:56:23Z Indexed on 2010/12/30 2:53 UTC
Read the original article Hit count: 198

Filed under:
|
|
|

Im developing my own framework that uses namespaces.

Doctrine is already integrated into my auto loading system and im now at the stage where ill be creating the model system for my application

Usually i would create a simple model like so:

namespace Application\Models;
class Users extends \Framework\Models\Database{}

which would inherit all the default database model methods, But with Doctrine im still learning how it all works, as its not just a simple DBAL.

I need to understand whats the part of doctrine my classes would extend where i can do the following:

namespace Application\Models;

class Users Extends Doctrine\Something\Table
{
    public $__table_name = "users";
}

And thus within the controller i would be able to do the following:

public function Display($uid)
{
    $User = $this->Model->Users->findOne(array("id" => (int)$id));
}

Anyone help me get my head around this ?

© Stack Overflow or respective owner

Related posts about php

Related posts about mvc