| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
* Our base DAO class. All DAO classes should inherit from this class.
return $this;
}
+ /**
+ * Deletes items from table which match current objects variables
+ *
+ * Returns the true on success
+ *
+ * for example
+ *
+ * Designed to be extended
+ *
+ * $object = new mytable();
+ * $object->ID=123;
+ * echo $object->delete(); // builds a conditon
+ *
+ * $object = new mytable();
+ * $object->whereAdd('age > 12');
+ * $object->limit(1);
+ * $object->orderBy('age DESC');
+ * $object->delete(true); // dont use object vars, use the conditions, limit and order.
+ *
+ * @param bool $useWhere (optional) If DB_DATAOBJECT_WHEREADD_ONLY is passed in then
+ * we will build the condition only using the whereAdd's. Default is to
+ * build the condition only using the object parameters.
+ *
+ * * @return mixed Int (No. of rows affected) on success, false on failure, 0 on no data affected
+ */
public function delete($useWhere = FALSE) {
$result = parent::delete($useWhere);
}
/**
- * Get the size and maxLength attributes for this text field
+ * Get the size and maxLength attributes for this text field.
* (or for all text fields) in the DAO object.
*
* @param string $class
* @param bool $i18nRewrite
* @param bool $trapException
*
- * @return CRM_Core_DAO
+ * @return CRM_Core_DAO|object
* object that holds the results of the query
+ * NB - if this is defined as just returning a DAO phpstorm keeps pointing
+ * out all the properties that are not part of the DAO
*/
public static function &executeQuery(
$query,
}
/**
- * make a shallow copy of an object
+ * make a shallow copy of an object.
* and all the fields in the object
*
* @param string $daoName
return $newObject;
}
+ /**
+ * Cascade update through related entities.
+ *
+ * @param string $daoName
+ * @param $fromId
+ * @param $toId
+ * @param array $newData
+ *
+ * @return null
+ */
public static function cascadeUpdate($daoName, $fromId, $toId, $newData = array()) {
$object = new $daoName();
$object->id = $fromId;