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 ?
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
精彩评论