I have two factories "News" and "Photoset". Can I somehow combine them?
$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();
Okey, just converted them to array and merged.
$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);