From 862791957aa3f15f51395bff3f62565bb9905553 Mon Sep 17 00:00:00 2001 From: zYne Date: Sat, 1 Sep 2007 17:46:42 +0000 Subject: [PATCH] --- manual/new/docs/en/class-templates.txt | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/manual/new/docs/en/class-templates.txt b/manual/new/docs/en/class-templates.txt index a157425c9..b2869911e 100644 --- a/manual/new/docs/en/class-templates.txt +++ b/manual/new/docs/en/class-templates.txt @@ -190,8 +190,33 @@ class AuthTemplate extends Doctrine_Record Now you can simply use the methods found in AuthTemplate within the User class as shown above. +$user = new User(); + $user->login($username, $password); +You can get the record that invoked the delegate method by using the getInvoker() method of Doctrine_Template. Consider the AuthTemplate example. If we want to have access to User object we just need to do the following: + + +class AuthTemplate extends Doctrine_Record +{ + public function setTableDefinition() + { + $this->hasColumn('username', 'string', 16); + $this->hasColumn('password', 'string', 16); + } + public function login($username, $password) + { + // do something with the Invoker object here + $object = $this->getInvoker(); + } +} + + + +++ Working with multiple templates + +Each class can consists of multiple templates. If the templates contain similar definitions the most recently loaded template always overrides the former. +