Skip to content

Commit

Permalink
Added getObjectIndex returning index of object matching search.
Browse files Browse the repository at this point in the history
git-svn-id: http://voip.null.ro/svn/ansql/trunk@122 dbfed7de-b0aa-0410-b6a1-c7e608b77fc9
  • Loading branch information
monica committed Nov 10, 2014
1 parent a8d9a03 commit 988a44b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions framework.php
Original file line number Diff line number Diff line change
Expand Up @@ -3323,6 +3323,21 @@ public function getNameInLogs()
return get_class($this);
}

/**
* Search object by $col_name=>$col_value and return index in object array
* @param $objects Array of objects -- typically returned from selection/extendedSelect
* @param $col_name String Name of the column the search is done for
* @param $col_value String Value of @col_name to search for
* @return Integer - index of the object or NULL if not found
*/
public function getObjectIndex($objects, $col_name, $col_value)
{
foreach ($objects as $i=>$obj)
if ($obj->{$col_name}==$col_value)
return $i;
return false;
}

/**
* Get the engine to use when creting mysql table
* Setting should be made in $db_engine in config.php
Expand Down

0 comments on commit 988a44b

Please sign in to comment.