From 51fbbb05d6603d842123656af70a0b580a5a95f0 Mon Sep 17 00:00:00 2001 From: zYne Date: Tue, 12 Sep 2006 17:52:23 +0000 Subject: [PATCH] AccessorInvoker code example --- ...ents - Evenlisteners - AccessorInvoker.php | 32 +++++++++++++++++++ ...ents - Evenlisteners - AccessorInvoker.php | 1 + 2 files changed, 33 insertions(+) create mode 100644 manual/codes/Advanced components - Evenlisteners - AccessorInvoker.php create mode 100644 manual/docs/Advanced components - Evenlisteners - AccessorInvoker.php diff --git a/manual/codes/Advanced components - Evenlisteners - AccessorInvoker.php b/manual/codes/Advanced components - Evenlisteners - AccessorInvoker.php new file mode 100644 index 000000000..1d9e464cd --- /dev/null +++ b/manual/codes/Advanced components - Evenlisteners - AccessorInvoker.php @@ -0,0 +1,32 @@ +hasColumn("name", "string", 200); + $this->hasColumn("password", "string", 32); + } + public function setPassword($password) { + return md5($password); + } + public function getName($name) { + return strtoupper($name); + } +} + +$user = new User(); + +$user->name = 'someone'; + +print $user->name; // someone + +$user->password = '123'; + +print $user->password; // 123 + +$user->setAttribute(Doctrine::ATTR_LISTENER, new Doctrine_EventListener_AccessorInvoker()); + +print $user->name; // SOMEONE + +$user->password = '123'; + +print $user->password; // 202cb962ac59075b964b07152d234b70 +?> diff --git a/manual/docs/Advanced components - Evenlisteners - AccessorInvoker.php b/manual/docs/Advanced components - Evenlisteners - AccessorInvoker.php new file mode 100644 index 000000000..d3f5a12fa --- /dev/null +++ b/manual/docs/Advanced components - Evenlisteners - AccessorInvoker.php @@ -0,0 +1 @@ +