Properly deletes address components on address deletion; return number of affected...
authorStéphane Jacob <sj@m4x.org>
Fri, 13 May 2011 12:00:53 +0000 (14:00 +0200)
committerStéphane Jacob <sj@m4x.org>
Fri, 13 May 2011 12:01:35 +0000 (14:01 +0200)
Signed-off-by: Stéphane Jacob <sj@m4x.org>
classes/address.php

index 7bea442..bca9e5f 100644 (file)
@@ -749,9 +749,14 @@ class Address
 
     public function delete()
     {
+        XDB::execute('DELETE FROM  profile_addresses_components
+                            WHERE  pid = {?} AND jobid = {?} AND groupid = {?} AND type = {?} AND id = {?}',
+                     $this->pid, $this->jobid, $this->groupid, $this->type, $this->id);
         XDB::execute('DELETE FROM  profile_addresses
                             WHERE  pid = {?} AND jobid = {?} AND groupid = {?} AND type = {?} AND id = {?}',
                      $this->pid, $this->jobid, $this->groupid, $this->type, $this->id);
+
+        return XDB::affectedRows();
     }
 
     static public function deleteAddresses($pid, $type, $jobid = null, $groupid = null, $deletePrivate = true)