Difference between revisions of "JTable/bind"
From Joomla! Documentation
< API15:JTable
(New page: ===Description===
Binds a named array/hash to this object
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>Edit Descripton<nowiki>]</now...) |
m (removing red link to edit, no existant pages) |
||
Line 3: | Line 3: | ||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
− | <nowiki>[< | + | <nowiki>[<! removed edit link to red link >]</nowiki> |
</span> | </span> | ||
− | + | <! removed transcluded page call, red link never existed > | |
===Syntax=== | ===Syntax=== | ||
Line 66: | Line 66: | ||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
− | <nowiki>[< | + | <nowiki>[<! removed edit link to red link >]</nowiki> |
</span> | </span> | ||
− | + | <! removed transcluded page call, red link never existed > | |
===Examples=== | ===Examples=== | ||
Line 81: | Line 81: | ||
format= ,,, | format= ,,, | ||
</dpl> | </dpl> | ||
+ | [[Category:Archived pages API15]] |
Revision as of 13:51, 12 May 2013
The "API15" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.
Description[edit]
Binds a named array/hash to this object
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
Syntax[edit]
bind($from, $ignore=array())
Parameter Name | Default Value | Description |
---|---|---|
$from | mixed An associative array or object | |
$ignore | array() | mixed An array or space separated list of fields not to bind |
Returns[edit]
boolean
Defined in[edit]
libraries/joomla/database/table.php
Importing[edit]
jimport( 'joomla.database.table' );
Source Body[edit]
function bind( $from, $ignore=array() )
{
$fromArray = is_array( $from );
$fromObject = is_object( $from );
if (!$fromArray && !$fromObject)
{
$this->setError( get_class( $this ).'::bind failed. Invalid from argument' );
return false;
}
if (!is_array( $ignore )) {
$ignore = explode( ' ', $ignore );
}
foreach ($this->getProperties() as $k => $v)
{
// internal attributes of an object are ignored
if (!in_array( $k, $ignore ))
{
if ($fromArray && isset( $from[$k] )) {
$this->$k = $from[$k];
} else if ($fromObject && isset( $from->$k )) {
$this->$k = $from->$k;
}
}
}
return true;
}
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples[edit]
<CodeExamplesForm />