0

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 ?

Jrgns
  • 24,699
  • 18
  • 71
  • 77
RobertPitt
  • 56,863
  • 21
  • 114
  • 161
  • Sorry, usual nitpick: if Model=Database, then that's [Passive-MVC](http://www.phpwact.org/pattern/model_view_controller#passive_model). – mario Dec 30 '10 at 00:03
  • Not all Models will extend a database, some may extend File Readers for example. – RobertPitt Dec 30 '10 at 00:07
  • Are you still working on your framework? Check out https://github.com/jrgns/backend-core, a framework I'm working on. I'm busy implementing Doctrine now. – Jrgns Nov 22 '11 at 05:58

1 Answers1

1

the sample code you supplied does not resemble either doctrine 1 or doctrine 2. by default, tables in doctrine 1 extend \Doctrine_Table. additionally the database table name is defined in the corresponding model file, not as a property of the table class itself. i suggest you read at least the first few chapters of the documention and look at some examples there

http://www.doctrine-project.org/projects/orm/1.2/docs/manual/introduction/en

Ryan
  • 26
  • 1