本文整理汇总了PHP中YDDebugUtil::r_dump方法的典型用法代码示例。如果您正苦于以下问题:PHP YDDebugUtil::r_dump方法的具体用法?PHP YDDebugUtil::r_dump怎么用?PHP YDDebugUtil::r_dump使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类YDDebugUtil
的用法示例。
在下文中一共展示了YDDebugUtil::r_dump方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: before_actionEdit_callback
function before_actionEdit_callback()
{
$browser = new YDBrowserInfo();
$agent = YDDebugUtil::r_dump($browser->agent, 'Agent');
$additional_information = "<p>Additional Information added by the before_actionEdit_callback() callback</p>";
$this->template->assign('browserinfo', '<pre>' . $agent . '</pre>' . $additional_information);
}
示例2: actionUsersAll
function actionUsersAll()
{
$user = YDDatabaseObject::getInstance('user');
$user->id = 1;
$user->findAll();
$this->template->assign('find1_results', YDDebugUtil::r_dump($user->getResults()));
$user->resetAll();
$user->id = 1;
$user->find('phone', 'group');
$this->template->assign('find2_results', YDDebugUtil::r_dump($user->getResults()));
$this->template->display('users_all');
}
示例3: find
/**
* This function finds the rows that match the object field's values
* an any other condition added with where, group, having, etc.
*
* You can add values to the method's parameters to search the relations.
*
* If you want to limit this query, use the setLimit method.
*
* @returns The number of records found.
*/
function find()
{
// before find callbacks
$this->_executeCallbacks('find', true);
YDDebugUtil::debug($this->getClassName() . YDDebugUtil::r_dump($this->getValues()));
$args = func_get_args();
$relations = array();
if (sizeof($args)) {
$relations = $args;
}
$this->_last = $relations;
$r = $this->_query->getReserved();
$this->_query->select();
$this->_query->resetFrom();
$pos = 0;
$slices = array();
// Add local table
$this->_query->table($this->getTable());
// Prepare query in local object
$this->_prepareQuery(true);
// Add the local slice
$slices[$pos] = '';
$pos = $pos + sizeof($this->_query->select);
// If there are any relations
foreach ($relations as $relation) {
// Load relation if not loaded yet
$this->load($relation);
$rel =& $this->getRelation($relation);
// Local table
$l_table = $this->getTable();
$l_key = $rel->getLocalKey();
if (!$l_key) {
$l_key = current($this->_getFieldsByMethod('isKey', false));
}
$l_field =& $this->getField($l_key);
$l_column = $l_field->getColumn();
// Foreign table
$f_var = $rel->getForeignVar();
$f_table = $this->{$f_var}->getTable();
$f_key = $rel->getForeignKey();
if (!$f_key) {
$f_key = current($this->{$f_var}->_getFieldsByMethod('isKey', false));
}
$f_field =& $this->{$f_var}->getField($f_key);
$f_column = $f_field->getColumn();
// Prepare the query in the foreign object
$this->{$f_var}->_prepareQuery(true);
// Add the foreign slice
$slices[$pos] = $f_var;
$pos = $pos + sizeof($this->{$f_var}->_query->select);
// Merge current selects with foreign selects
$this->_query->select = array_merge($this->_query->select, $this->{$f_var}->_query->select);
// Not many to many
if (!$rel->isManyToMany()) {
// Join foreign table
$this->_query->join($rel->getForeignJoin(), $f_table);
$this->_query->on($r . $l_table . $r . '.' . $r . $l_column . $r . ' = ' . $r . $f_table . $r . '.' . $r . $f_column . $r);
} else {
// Many to many relation
// Cross-table
$c_var = $rel->getCrossVar();
$c_table = $this->{$c_var}->getTable();
// Default cross foreign and local key
$c_fkey = $f_table . '_' . $f_key;
$c_lkey = $l_table . '_' . $l_key;
// User-defined cross foreign key
if ($rel->getCrossForeignKey()) {
$c_fkey = $rel->getCrossForeignKey();
}
// User-defined cross local key
if ($rel->getCrossLocalKey()) {
$c_lkey = $rel->getCrossLocalKey();
}
// Cross foreign field column name
$c_ffield =& $this->{$c_var}->getField($c_fkey);
$c_fcolumn = $c_ffield->getColumn();
// Cross local field column name
$c_lfield =& $this->{$c_var}->getField($c_lkey);
$c_lcolumn = $c_lfield->getColumn();
// Prepare the query in the cross object
$this->{$c_var}->_prepareQuery(true);
// Add the cross slice
$slices[$pos] = $c_var;
$pos = $pos + sizeof($this->{$c_var}->_query->select);
// Merge current selects with cross selects
$this->_query->select = array_merge($this->_query->select, $this->{$c_var}->_query->select);
// Join cross table
$this->_query->join($rel->getCrossJoin(), $c_table);
$this->_query->on($r . $l_table . $r . '.' . $r . $l_column . $r . ' = ' . $r . $c_table . $r . '.' . $r . $c_lcolumn . $r);
// Cross table additional conditions
//.........这里部分代码省略.........
示例4: dump
/**
* Function to dump the contents of pretty much anything. This is the same as the var_dump function in PHP, but
* has a nicer and more readable output.
*
* @param $obj Object you want to dump.
* @param $label The label for the dump.
*/
function dump($obj, $label = '')
{
echo YDDebugUtil::r_dump($obj, true, $label);
}
示例5: delete
/**
* This function executes an DELETE query based on the values of the object
* or any condition set by addWhere and addOrder.
*
* @returns The number of rows affected.
*/
function delete()
{
$this->__sql->setAction('DELETE');
$this->__sql->resetFrom();
$this->__sql->addTable($this->getTable());
$this->_prepareQuery($this, true);
$where = $this->__sql->getWhere(false);
$order = $this->__sql->getOrder();
$this->resetQuery();
YDDebugUtil::debug('YDDatabaseObject ' . $this->getClassName() . YDDebugUtil::r_dump($this->getValues()));
// Not secure if no conditions...
if (!strlen(trim($where)) && !YDConfig::get('YD_DATABASEOBJECT_DELETE')) {
trigger_error('YDDatabaseObject delete - ' . $this->getClassName() . ' -
Your DELETE query has no conditions and will not be executed.', YD_NOTICE);
return;
}
$result = $this->__db->executeDelete($this->getTable(), $where . $order);
$this->__count = (int) $result;
YDDebugUtil::debug(end($GLOBALS['YD_SQL_QUERY']));
return $this->__count;
}
示例6: toArray
/**
* This function will return the form as an array.
*
* @returns The form as an array.
*/
function toArray()
{
// Start with an empty array
$form = array();
// Add the list of attributes
$attribs = array('name' => $this->_name, 'id' => $this->_name, 'method' => strtoupper($this->_method), 'action' => $this->_action, 'target' => $this->_target);
$attribs = array_merge($this->_attributes, $attribs);
$form['attribs'] = $this->_convertToHtmlAttrib($attribs);
$form['tag'] = '<form' . $form['attribs'] . '>';
$form['requirednote'] = $this->_requiredNote;
// Add the errors
$form['errors'] = $this->_errors;
// Loop over the list of elements
foreach ($this->_elements as $name => $element) {
// Update the value
$element->_value = $this->getValue($name);
// Add the form element
$form[$name] = $element->toArray();
// Add errors if any
if (array_key_exists($name, $this->_errors)) {
$form[$name]['error'] = $this->_errors[$name];
} else {
$form[$name]['error'] = '';
}
// Check if the field is required
if (array_key_exists($name, $this->_rules)) {
$form[$name]['required'] = true;
} else {
$form[$name]['required'] = false;
}
}
// If debugging, show contents
if (YD_DEBUG) {
YDDebugUtil::debug(YDDebugUtil::r_dump($form));
}
// Return the form array
return $form;
}