本文整理汇总了PHP中JTable::bind方法的典型用法代码示例。如果您正苦于以下问题:PHP JTable::bind方法的具体用法?PHP JTable::bind怎么用?PHP JTable::bind使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JTable
的用法示例。
在下文中一共展示了JTable::bind方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load
private function load()
{
$result = false;
// Load the table object, empty if _state->data->key = null;
$this->getTable()->load($this->_state->get($this->_key, null));
//if we have incoming data, bind it to the table object
if ($data = $this->_state->get('data', false)) {
$this->_table->bind($data);
}
//set the state to the table data.
$this->_state->set('data', get_object_vars($this->_table));
}
示例2: unserialize
/**
* Get a connection table object
*
* @param int $id connection id
*
* @return object connection tables
*/
public function &getConnection($id = null)
{
if (!is_null($id)) {
$this->setId($id);
}
if (!is_object($this->_connection)) {
$session = JFactory::getSession();
$key = 'fabrik.connection.' . $this->_id;
if ($session->has($key)) {
$connProperties = unserialize($session->get($key));
// $$$ rob since J1.6 - connection properties stored as an array (in f2 it was an object)
if (is_a($connProperties, '__PHP_Incomplete_Class') || JArrayHelper::getValue($connProperties, 'id') == '') {
$session->clear($key);
} else {
$this->_connection = FabTable::getInstance('connection', 'FabrikTable');
$this->_connection->bind($connProperties);
return $this->_connection;
}
}
if ($this->_id == -1 || $this->_id == '') {
$this->_connection = $this->loadDefaultConnection();
} else {
$this->_connection = FabTable::getInstance('Connection', 'FabrikTable');
$this->_connection->load($this->_id);
}
// $$$ rob store the connection for later use as it may be required by modules/plugins
$session->set($key, serialize($this->_connection->getProperties()));
}
return $this->_connection;
}
示例3: bind
/**
* Bind Table override
* @override
*
* @see JTable::bind()
*/
public function bind($fromArray, $saveTask = false, $sessionTask = false)
{
parent::bind($fromArray);
if ($saveTask) {
$services = array();
foreach ($fromArray as $key => $value) {
if (strpos($key, 'chk_') === 0) {
$services[$key] = $value;
}
}
if (is_array($services)) {
$this->services = json_encode($services);
}
}
// Manage complex attributes during session recovering bind/load
if ($sessionTask) {
$services = array();
foreach ($fromArray as $key => $value) {
if (strpos($key, 'chk_') === 0) {
$services[$key] = $value;
}
}
$registry = new JRegistry($services);
$this->services = $registry;
}
return true;
}
示例4: bind
public function bind($src, $ignore = array())
{
if (!is_object($src) && !is_array($src)) {
$src = new stdClass();
}
return parent::bind($src, $ignore);
}
示例5: bind
public function bind($array, $ignore = '')
{
// in here we are checking for the empty value of the checkbox
//don't override without calling base class
return parent::bind($array, $ignore);
}
示例6: bind
/**
* Overloaded bind function to pre-process the params.
*
* @param array Named array
* @return null|string null is operation was satisfactory, otherwise returns an error
* @see JTable:bind
* @since 1.5
*/
public function bind($array, $ignore = '')
{
if (isset($array['print_title']) && is_array($array['print_title'])) {
$array['print_title'] = array_filter($array['print_title']);
if (count($array['print_title'])) {
$registry = new JRegistry();
$registry->loadArray($array['print_title']);
$array['print_title'] = (string) $registry;
}
}
if (isset($array['nutrients']) && is_array($array['nutrients'])) {
$registry = new JRegistry();
$registry->loadArray($array['nutrients']);
$array['nutrients'] = (string) $registry;
}
if (isset($array['compositions']) && is_array($array['compositions'])) {
// delete 0 values
$array['compositions'] = array_filter($array['compositions']);
$registry = new JRegistry();
$registry->loadArray($array['compositions']);
$array['compositions'] = (string) $registry;
// if composition has sub compositions then nutrients values must delete
$array['nutrients'] = '';
}
return parent::bind($array, $ignore);
}
示例7: bind
/**
* Overloaded bind function
*
* @param array $array Named array to bind
* @param mixed $ignore An optional array or space separated list of properties to ignore while binding.
*
* @return null|string null is operation was satisfactory, otherwise returns an error
*
*/
public function bind($array, $ignore = array())
{
if (!array_key_exists('readonly', $array)) {
$array['readonly'] = '0';
}
return parent::bind($array, $ignore);
}
示例8: testDelete
/**
* Test for delete method with no primary key specified.
*
* @return void
*
* @since 12.3
*/
public function testDelete()
{
$this->assertEquals(2, $this->getConnection()->getRowCount('jos_dbtest_composite'), "Pre-Condition");
$this->object->bind(array('id1' => 25, 'id2' => 50, 'title' => 'My Title'));
$this->object->delete();
$this->assertEquals(1, $this->getConnection()->getRowCount('jos_dbtest_composite'), "Delete failed.");
}
示例9: bind
/**
* Overloaded bind function to pre-process the params.
*
* @param array Named array
* @return null|string null is operation was satisfactory, otherwise returns an error
* @see JTable:bind
* @since 3.3.3
*/
public function bind($array, $ignore = '')
{
if ($array['date'] == 'update') {
$array['date'] = '';
}
return parent::bind($array, $ignore);
}
示例10: bind
public function bind($src, $ignore = array())
{
if (empty($src) || is_null($src)) {
return true;
}
return parent::bind($src, $ignore);
}
示例11: bind
/**
* Overloaded bind function to pre-process the params.
*
* @param array Named array
* @return null|string null is operation was satisfactory, otherwise returns an error
* @see JTable:bind
*/
public function bind($array, $ignore = '')
{
if (isset($array['body']) && is_array($array['body'])) {
$registry = new JRegistry();
$registry->loadArray($array['body']);
$array['body'] = (string) $registry;
}
if (isset($array['special']) && is_array($array['special'])) {
$registry = new JRegistry();
$registry->loadArray($array['special']);
$array['special'] = (string) $registry;
}
if (isset($array['laboratory']) && is_array($array['laboratory'])) {
$registry = new JRegistry();
$registry->loadArray($array['laboratory']);
$array['laboratory'] = (string) $registry;
}
if (isset($array['payment']) && is_array($array['payment'])) {
$registry = new JRegistry();
$registry->loadArray($array['payment']);
$array['payment'] = (string) $registry;
}
if (isset($array['ctags']) && is_array($array['ctags'])) {
$array['ctags'] = implode(',', $array['ctags']);
} else {
$data['ctags'] = '';
}
return parent::bind($array, $ignore);
}
示例12: bind
/**
* Method to bind an associative array or object to the JTable instance.This
* method only binds properties that are publicly accessible and optionally
* takes an array of properties to ignore when binding.
*
* @param mixed $array An associative array or object to bind to the JTable instance.
* @param mixed $ignore An optional array or space separated list of properties to ignore while binding.
*
* @return boolean True on success.
*
* @link https://docs.joomla.org/JTable/bind
* @since 3.2
* @throws UnexpectedValueException
*/
public function bind($array, $ignore = '')
{
if (isset($array['item_description'])) {
$pattern = '#<hr\\s+id=("|\')system-readmore("|\')\\s*\\/*>#i';
$tagPos = preg_match($pattern, $array['item_description']);
if ($tagPos == 0) {
$this->introtext = $array['item_description'];
$this->fulltext = '';
} else {
list($this->introtext, $this->fulltext) = preg_split($pattern, $array['item_description'], 2);
}
}
if (isset($array['params']) && is_array($array['params'])) {
$tmp = array();
foreach ($array['params']['attr'] as $key => $param) {
$tmp['attr_' . $key] = $param;
}
$array['params'] = json_encode($tmp);
}
if (isset($array['metadata']) && is_array($array['metadata'])) {
$registry = new JRegistry();
$registry->loadArray($array['metadata']);
$array['metadata'] = (string) $registry;
}
if (isset($array['techs']) && is_array($array['techs'])) {
$registry = new JRegistry();
$registry->loadArray($array['techs']);
$array['techs'] = (string) $registry;
}
return parent::bind($array, $ignore);
}
示例13: bind
/**
* Overloaded bind function
* @access public
* @param array $hash named array
* @return null|string null is operation was satisfactory, otherwise returns an error
*/
public function bind($array, $ignore = '')
{
if (key_exists('params', $array) && is_array($array['params'])) {
$array['params'] = json_encode($array['params']);
}
return parent::bind($array, $ignore);
}
示例14: bind
public function bind($array, $ignore = '')
{
if (!isset($array['lic'])) {
$array['lic'] = '0';
}
return parent::bind($array, $ignore);
}
示例15: bind
/**
* Overloaded bind function
*
* @param array $hash named array
* @return null|string null is operation was satisfactory, otherwise returns an error
* @see JTable:bind
* @since 1.5
*/
public function bind($array, $ignore = '')
{
if (is_array($array['categoria'])) {
$array['categoria'] = implode(',', $array['categoria']);
}
return parent::bind($array, $ignore);
}