summaryrefslogtreecommitdiff
path: root/demos/address-book/protected/pages/AddressProvider.php
diff options
context:
space:
mode:
Diffstat (limited to 'demos/address-book/protected/pages/AddressProvider.php')
-rw-r--r--demos/address-book/protected/pages/AddressProvider.php96
1 files changed, 48 insertions, 48 deletions
diff --git a/demos/address-book/protected/pages/AddressProvider.php b/demos/address-book/protected/pages/AddressProvider.php
index 94b71e11..e903f540 100644
--- a/demos/address-book/protected/pages/AddressProvider.php
+++ b/demos/address-book/protected/pages/AddressProvider.php
@@ -1,50 +1,50 @@
-<?php
-Prado::using('Application.pages.AddressRecord');
-/**
- * @author Wei Zhuo <weizho[at]gmail[dot]com>
- * @version $Id$
- * @since 3.1
- */
-class AddressProvider
-{
- /**
- * @return AddressRecord[]
- * @soapmethod
- */
- public function getAllAddress()
- {
- return AddressRecord::finder()->findAll();
- }
-
- /**
- * Update address if $data->id > 0, otherwise add new address.
- * @param AddressRecord $data
- * @return boolean
- * @soapmethod
- */
- public function saveAddress($data)
- {
- $finder = AddressRecord::finder();
- if($data->id > 0 && $address=$finder->findByPk($data->id))
- {
- return $address->copyFrom($data)->save();
- }
- else
- {
- $data->id = null; //nullify the id
- return $data->save();
- }
- }
-
- /**
- * @param integer $id
- * @return integer number of records deleted
- * @soapmethod
- */
- public function deleteAddress($id)
- {
- return AddressRecord::finder()->deleteByPk($id);
- }
-}
+<?php
+Prado::using('Application.pages.AddressRecord');
+/**
+ * @author Wei Zhuo <weizho[at]gmail[dot]com>
+ * @version $Id$
+ * @since 3.1
+ */
+class AddressProvider
+{
+ /**
+ * @return AddressRecord[]
+ * @soapmethod
+ */
+ public function getAllAddress()
+ {
+ return AddressRecord::finder()->findAll();
+ }
+
+ /**
+ * Update address if $data->id > 0, otherwise add new address.
+ * @param AddressRecord $data
+ * @return boolean
+ * @soapmethod
+ */
+ public function saveAddress($data)
+ {
+ $finder = AddressRecord::finder();
+ if($data->id > 0 && $address=$finder->findByPk($data->id))
+ {
+ return $address->copyFrom($data)->save();
+ }
+ else
+ {
+ $data->id = null; //nullify the id
+ return $data->save();
+ }
+ }
+
+ /**
+ * @param integer $id
+ * @return integer number of records deleted
+ * @soapmethod
+ */
+ public function deleteAddress($id)
+ {
+ return AddressRecord::finder()->deleteByPk($id);
+ }
+}
?> \ No newline at end of file