/** * @Route /performance/list */ public function listAction() { $cache = new \Raptor\Cache\Cache('performance'); if ($cache->hasCache()) { $performance = $cache->getData(); } else { $performance = new ItemList(); } $series = array(); $performance->each(function ($key, $value) use(&$series) { $item = new ItemList(); $item->set('value', $value); $item->set('no', $key); $series[] = $item->getArray(); }); return $this->JSON(new ItemList($series)); }
/** * @Route /gendoctrine/schema/listClasses */ public function listClassesAction($request) { $bundle = $request->post('name'); $spc = $this->app->getConfigurationLoader()->getBundlesSpecifications(); $absolute = $spc[$bundle]['location']; $supose = new ItemList(glob($absolute . '/Model/Entity/*.php')); $supose->each(function ($key, $value, $list) use($bundle) { $class = new ItemList(); $name = explode($bundle, $value); $name = $name[1]; $class->set('class', $bundle . $name); $className = str_replace('/Model/Entity/', '', $name); $className = str_replace('.php', '', $className); $class->set('class', $bundle . $name); $class->set('name', $className); $list->set($key, $class->getArray()); }); return $this->JSON($supose); }
public function set($key, $item) { parent::set($key, $item); $session = \Raptor\Raptor::getInstance()->getSession(); $session->put($this->getArray()); }
/** * Este metodo es usado para enviar datos desde el lado del servidor al cliente en formato JSON, * establece el contentType apropiado para la respuesta * * @param array|ItemList $data Array asociativo con los datos a enviar */ public function data($data) { $cod = Controller::DATA; $msgObj = new ItemList(); $msgObj->set('success', true); $msgObj->set('cod', $cod); foreach ($data as $key => $value) { $msgObj->set($key, $value); } $this->app->contentType(\Raptor\Raptor::JSON); return $msgObj->toJson(); }