/**
* Class constructor
*
- * @return object
- * @access public
+ * @return \CRM_Core_DAO
+ @access public
*/
function __construct() {
$this->initialize();
/**
* Factory method to instantiate a new object from a table name.
*
+ * @param string $table
+ *
* @return void
* @access public
*/
* @static
* @access public
*
- * @return array of CRM_Core_EntityReference
+ * @return array of CRM_Core_Reference_Interface
*/
static function getReferenceColumns() {
return array();
*
* @param string $tableName
*
+ * @param int $maxTablesToCheck
+ * @param string $fieldName
+ *
* @return array
* @static
*/
/**
* Checks if CONSTRAINT keyword exists for a specified table.
*
- * @param string $tableName
+ * @param array $tables
+ *
+ * @throws Exception
+ * @internal param string $tableName
*
* @return boolean true if CONSTRAINT keyword exists, false otherwise
*/
*
* @param string $query query to be executed
*
+ * @param array $params
+ * @param bool $abort
+ * @param null $daoName
+ * @param bool $freeDAO
+ * @param bool $i18nRewrite
+ * @param bool $trapException
+ *
* @return Object CRM_Core_DAO object that holds the results of the query
* @static
* @access public
* of time. This is the inverse function of create. It also stores all the retrieved
* values in the default array
*
- * @param string $daoName name of the dao object
- * @param array $params (reference ) an assoc array of name/value pairs
- * @param array $defaults (reference ) an assoc array to hold the flattened values
- * @param array $returnProperities an assoc array of fields that need to be returned, eg array( 'first_name', 'last_name')
+ * @param string $daoName name of the dao object
+ * @param string $fieldIdName
+ * @param $fieldId
+ * @param $details
+ * @param array $returnProperities an assoc array of fields that need to be returned, eg array( 'first_name', 'last_name')
*
+ * @internal param array $params (reference ) an assoc array of name/value pairs
+ * @internal param array $defaults (reference ) an assoc array to hold the flattened values
* @return object an object of type referenced by daoName
* @access public
* @static
}
}
- /**
- * Build a list of triggers via hook and add them to (err, reconcile them
- * with) the database.
- *
- * @param $tableName string the specific table requiring a rebuild; or NULL to rebuild all tables
- * @see CRM-9716
- */
+ /**
+ * Build a list of triggers via hook and add them to (err, reconcile them
+ * with) the database.
+ *
+ * @param $tableName string the specific table requiring a rebuild; or NULL to rebuild all tables
+ * @param bool $force
+ *
+ * @see CRM-9716
+ */
static function triggerRebuild($tableName = NULL, $force = FALSE) {
$info = array();
$occurrences = array();
foreach ($links as $refSpec) {
- $refColumn = $refSpec->getReferenceKey();
- $targetColumn = $refSpec->getTargetKey();
- $params = array(1 => array($this->$targetColumn, 'String'));
- $sql = <<<EOS
-SELECT id
-FROM {$refSpec->getReferenceTable()}
-WHERE {$refColumn} = %1
-EOS;
- if ($refSpec->isGeneric()) {
- $params[2] = array(static::getTableName(), 'String');
- $sql .= <<<EOS
- AND {$refSpec->getTypeColumn()} = %2
-EOS;
- }
+ /** @var $refSpec CRM_Core_Reference_Interface */
$daoName = CRM_Core_DAO_AllCoreTables::getClassForTable($refSpec->getReferenceTable());
- $result = self::executeQuery($sql, $params, TRUE, $daoName);
+ $result = $refSpec->findReferences($this);
while ($result->fetch()) {
$obj = new $daoName();
$obj->id = $result->id;
$daoTableName = $daoClassName::getTableName();
foreach ($links as $refSpec) {
- if ($refSpec->getTargetTable() === $tableName
- or $refSpec->isGeneric()
- ) {
+ /** @var $refSpec CRM_Core_Reference_Interface */
+ if ($refSpec->matchesTargetTable($tableName)) {
$refsFound[] = $refSpec;
}
}
* The overriding function will generally call the lower-level CRM_Core_PseudoConstant::get
*
* @param string $fieldName
- * @param string $context: @see CRM_Core_DAO::buildOptionsContext
- * @param array $props: whatever is known about this bao object
+ * @param string $context : @see CRM_Core_DAO::buildOptionsContext
+ * @param array $props : whatever is known about this bao object
+ *
+ * @return Array|bool
*/
public static function buildOptions($fieldName, $context = NULL, $props = array()) {
// If a given bao does not override this function
* Provides documentation and validation for the buildOptions $context param
*
* @param String $context
+ *
+ * @throws Exception
+ * @return array
*/
public static function buildOptionsContext($context = NULL) {
$contexts = array(
* $field => array('LIKE' => array('%me%))
* etc
*
- * @param $fieldname string name of fields
+ * @param $fieldName
* @param $filter array filter to be applied indexed by operator
* @param $type String type of field (not actually used - nor in api @todo )
* @param $alias String alternative field name ('as') @todo- not actually used
* @param bool $returnSanitisedArray return a sanitised array instead of a clause
* this is primarily so we can add filters @ the api level to the Query object based fields
- * @todo a better solutution would be for the query object to apply these filters based on the
+ *
+ * @throws Exception
+ * @internal param string $fieldname name of fields
+ * @todo a better solutution would be for the query object to apply these filters based on the
* api supported format (but we don't want to risk breakage in alpha stage & query class is scary
- * @todo @time of writing only IN & NOT IN are supported for the array style syntax (as test is
+ * @todo @time of writing only IN & NOT IN are supported for the array style syntax (as test is
* required to extend further & it may be the comments per above should be implemented. It may be
* preferable to not double-banger the return context next refactor of this - but keeping the attention
* in one place has some advantages as we try to extend this format
*
- * @return NULL|string|array a string is returned if $returnSanitisedArray is not set, otherwise and Array or NULL
+ * @return NULL|string|array a string is returned if $returnSanitisedArray is not set, otherwise and Array or NULL
* depending on whether it is supported as yet
- **/
+ */
public static function createSQLFilter($fieldName, $filter, $type, $alias = NULL, $returnSanitisedArray = FALSE) {
// http://issues.civicrm.org/jira/browse/CRM-9150 - stick with 'simple' operators for now
// support for other syntaxes is discussed in ticket but being put off for now
* strings that meet various criteria.
*
* @param string $string - the string to be shortened
- * @param int $length - the max length of the string
+ * @param int $length - the max length of the string
+ *
+ * @param bool $makeRandom
+ *
+ * @return string
*/
public static function shortenSQLName($string, $length = 60, $makeRandom = FALSE) {
// early return for strings that meet the requirements