Changed "Photo::select(" to "Photo::selectToArray("

This commit is contained in:
Michael 2019-07-27 15:52:02 +00:00
parent ac6bfd3e4c
commit 89454fabdb
2 changed files with 8 additions and 10 deletions

View file

@ -55,8 +55,7 @@ class Attach extends BaseObject
$fields = self::getFields(); $fields = self::getFields();
} }
$r = DBA::select('attach', $fields, $conditions, $params); $r = DBA::selectToArray('attach', $fields, $conditions, $params);
return DBA::toArray($r);
} }
/** /**

View file

@ -29,7 +29,7 @@ require_once "include/dba.php";
class Photo extends BaseObject class Photo extends BaseObject
{ {
/** /**
* @brief Select rows from the photo table * @brief Select rows from the photo table and returns 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
@ -38,16 +38,15 @@ class Photo 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();
} }
$r = DBA::select("photo", $fields, $conditions, $params); return DBA::selectToArray("photo", $fields, $conditions, $params);
return DBA::toArray($r);
} }
/** /**
@ -89,7 +88,7 @@ class Photo extends BaseObject
$conditions["resource-id"] = $resourceid; $conditions["resource-id"] = $resourceid;
$conditions["uid"] = $uid; $conditions["uid"] = $uid;
return self::select([], $conditions, $params); return self::selectToArray([], $conditions, $params);
} }
/** /**
@ -350,7 +349,7 @@ class Photo extends BaseObject
public static function delete(array $conditions, array $options = []) public static function delete(array $conditions, array $options = [])
{ {
// get photo to delete data info // get photo to delete data info
$photos = self::select(["backend-class","backend-ref"], $conditions); $photos = self::selectToArray(["backend-class","backend-ref"], $conditions);
foreach($photos as $photo) { foreach($photos as $photo) {
/** @var IStorage $backend_class */ /** @var IStorage $backend_class */
@ -380,7 +379,7 @@ class Photo extends BaseObject
{ {
if (!is_null($img)) { if (!is_null($img)) {
// get photo to update // get photo to update
$photos = self::select(["backend-class","backend-ref"], $conditions); $photos = self::selectToArray(["backend-class","backend-ref"], $conditions);
foreach($photos as $photo) { foreach($photos as $photo) {
/** @var IStorage $backend_class */ /** @var IStorage $backend_class */