]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #3782 only deleting metadata if the entity has been saved
authorCash Costello <cash.costello@gmail.com>
Sat, 10 Sep 2011 22:09:15 +0000 (18:09 -0400)
committerCash Costello <cash.costello@gmail.com>
Sat, 10 Sep 2011 22:09:15 +0000 (18:09 -0400)
engine/classes/ElggEntity.php

index 7c8828a98e6ce35445c3e439625711a2a2af4db1..2fa0d7b02a78d0a1c4fd140392c14830d9f1f6dc 100644 (file)
@@ -371,13 +371,18 @@ abstract class ElggEntity extends ElggData implements
         * Deletes all metadata on this object (metadata.entity_guid = $this->guid).
         * If you pass a name, only metadata matching that name will be deleted.
         *
-        * @warning Calling this with no or empty arguments will clear all metadata on the entity.
+        * @warning Calling this with no $name will clear all metadata on the entity.
         *
-        * @param null|string $name The metadata name to remove.
+        * @param null|string $name The name of the metadata to remove.
         * @return bool
         * @since 1.8
         */
        public function deleteMetadata($name = null) {
+
+               if (!$this->guid) {
+                       return false;
+               }
+
                $options = array(
                        'guid' => $this->guid,
                        'limit' => 0