diff --git a/library/Controller.php b/library/Controller.php index af74170..4a0da08 100644 --- a/library/Controller.php +++ b/library/Controller.php @@ -206,13 +206,21 @@ public function indexAction() */ public function readAction() { - $pkey = $this->primaryKey[0]; + //$pkey = $this->primaryKey[0]; - if (null === ($id = $this->_getParam($pkey))) { + if (null === ($id = $this->_getParam('primary-key'))) { return $this->_helper->redirector('list'); } - $record = $this->obj->find($id)->toArray(); + $primaryKey = unserialize($id); + + $record = call_user_func_array( + array($this->obj, 'find'), + array_values($primaryKey) + )->toArray(); + + //$this->obj->find($id)->toArray(); + $this->view->assign('record', $record[0]); $this->view->assign('pkValue', $id); return $this->render('crud/detail', null, true); diff --git a/views/scripts/crud/list.phtml b/views/scripts/crud/list.phtml index 4c5d3d9..1b94a5a 100644 --- a/views/scripts/crud/list.phtml +++ b/views/scripts/crud/list.phtml @@ -18,11 +18,11 @@ paginator as $row): ?> - + $val): ?> primary[0]) { - $_primary = $val; + if (in_array($col, $this->primary)) { + $_primary[$col] = $val; } ?> cols)): ?> @@ -30,7 +30,7 @@ - Detail + Detail