Kohana 联合 orm 工厂

Kohana combine orm factories

我有两个工厂“News”和“Photoset”。我能以某种方式将它们组合起来吗?

$news = ORM::factory('News')
        ->where('title_'.I18n::$lang, '<>', '')
        ->and_where('image', '<>', '')
        ->and_where('published', '=', 1)
        ->and_where('is_slider', '=', 1)
        ->and_where('date', '<', DB::expr('UNIX_TIMESTAMP()'))
        ->order_by('date','desc')
        ->limit(4)
        ->find_all();

$photoset = ORM::factory('Photoset')
        ->where('name_'.I18n::$lang, '<>', '')
        ->and_where('published', '=', 1)
        ->and_where('is_slider', '=', 0)
        ->order_by('date','desc')
        ->limit(4)
        ->find_all();

好的,只是将它们转换为数组并合并。

$news = ORM::factory('News')
        ->where('title_'.I18n::$lang, '<>', '')
        ->and_where('image', '<>', '')
        ->and_where('published', '=', 1)
        ->and_where('is_slider', '=', 1)
        ->and_where('date', '<', DB::expr('UNIX_TIMESTAMP()'))
        ->order_by('date','desc')
        ->limit(4)
        ->find_all()
        ->as_array();

$photoset = ORM::factory('Photoset')
        ->where('name_'.I18n::$lang, '<>', '')
        ->and_where('published', '=', 1)
        ->and_where('is_slider', '=', 0)
        ->order_by('date','desc')
        ->limit(4)
        ->find_all()
        ->as_array();

$newArray = Arr::merge($news, $photoset);