/** * @Route("/", methods="GET") */ public function indexAction() { $widgets = Widget::findAll(); $positions = App::position()->all(); foreach ($positions as &$position) { $position['widgets'] = []; foreach ($position['assigned'] as $id) { if (isset($widgets[$id])) { $position['widgets'][] = $widgets[$id]; unset($widgets[$id]); } } } return ['positions' => array_values($positions), 'unassigned' => array_values($widgets)]; }
/** * @Route("/", methods="GET") */ public function indexAction() { return array_values(Widget::findAll()); }