Changed Attach::select to Attach::selectToArray

This commit is contained in:
Michael 2019-07-27 15:47:17 +00:00
parent 975ff86bae
commit ac6bfd3e4c

View file

@ -38,7 +38,7 @@ class Attach extends BaseObject
} }
/** /**
* @brief Select rows from the attach table * @brief Select rows from the attach table and return them as array
* *
* @param array $fields Array of selected fields, empty for all * @param array $fields Array of selected fields, empty for all
* @param array $conditions Array of fields for conditions * @param array $conditions Array of fields for conditions
@ -47,9 +47,9 @@ class Attach extends BaseObject
* @return boolean|array * @return boolean|array
* *
* @throws \Exception * @throws \Exception
* @see \Friendica\Database\DBA::select * @see \Friendica\Database\DBA::selectToArray
*/ */
public static function select(array $fields = [], array $conditions = [], array $params = []) public static function selectToArray(array $fields = [], array $conditions = [], array $params = [])
{ {
if (empty($fields)) { if (empty($fields)) {
$fields = self::getFields(); $fields = self::getFields();
@ -264,7 +264,7 @@ class Attach extends BaseObject
{ {
if (!is_null($img)) { if (!is_null($img)) {
// get items to update // get items to update
$items = self::select(['backend-class','backend-ref'], $conditions); $items = self::selectToArray(['backend-class','backend-ref'], $conditions);
foreach($items as $item) { foreach($items as $item) {
/** @var IStorage $backend_class */ /** @var IStorage $backend_class */
@ -297,7 +297,7 @@ class Attach extends BaseObject
public static function delete(array $conditions, array $options = []) public static function delete(array $conditions, array $options = [])
{ {
// get items to delete data info // get items to delete data info
$items = self::select(['backend-class','backend-ref'], $conditions); $items = self::selectToArray(['backend-class','backend-ref'], $conditions);
foreach($items as $item) { foreach($items as $item) {
/** @var IStorage $backend_class */ /** @var IStorage $backend_class */