public function findMediaByCategoryId(int $catId = null)
    {
        if (null === $catId) {
            return;
        }

        $this->sql = <<<SQL
select
    mc.category,
    m.id,
    m.file,
    m.caption
from media_category mc
join media_category_map mcp on mc.id = mcp.category_id
join media m on mcp.media_id = m.id
where mc.id = ?
SQL;
        $this->bindValues[] = $catId;
        return $this->find();
    }
public function findMediaByCategoryId(int $catId = null)
    {
        if (null === $catId) {
            return;
        }

        $this->sql = <<<SQL
select
    mc.category,
    m.id,
    m.file,
    m.caption
from media_category mc
join media_category_map mcp on mc.id = mcp.category_id
join media m on mcp.media_id = m.id
where mc.id = ?
SQL;
        $this->bindValues[] = $catId;
        return $this->find();
    }
public function findMediaByCategoryId ( int $ catId = null ) { if ( null === $ catId ) { return ; } $ this -> sql =  <<<SQL
select
    mc.category,
    m.id,
    m.file,
    m.caption
from media_category mc
join media_category_map mcp on mc.id = mcp.category_id
join media m on mcp.media_id = m.id
where mc.id = ?
SQL ; $ this -> bindValues [ ] = $ catId ; return $ this -> find ( ) ; }
Find Media By Category ID

Find media by category ID
@param  int   $catId
@return mixed
Find Media By Category ID