Skip to content

Instantly share code, notes, and snippets.

@Rezvitsky Rezvitsky/wall.php
Created May 25, 2020

Embed
What would you like to do?
wall.php
function get_wall(int $owner_id): array
{
$db = DbMysqlProvider::getConnection();
$db->where('owner_id', $owner_id);
$db->where('active', 1);
$db->orderBy('date', 'DESC');
$raw_wall = $db->get('wall');
$raw_wall = array_combine(
array_map(function ($item) { return $item['id']; }, $raw_wall),
$raw_wall
);
$db->where('wall', array_keys($raw_wall), 'IN');
$db->where('active', 1);
$raw_audio = $db->get('wall_audios', null, 'audio');
foreach ($raw_audio as $item) {
$audios[] = $item;
}
var_dump($audios);
return $raw_wall ?? [];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.