public function testRetrievePersons() { $model = new Admin_Model_DocumentEditSession(146); $this->assertEmpty($model->retrievePersons()); $props = array('person' => 310, 'role' => 'author', 'order' => 2, 'contact' => 1); $model->addPerson($props); $this->assertEquals(1, count($model->retrievePersons())); // retrievePersons removes variable from session $this->assertEmpty($model->retrievePersons()); }
/** * Wird nach dem Rücksprung von Add/Edit Seite für Person aufgerufen, um das Ergebnis ins Formular einzubringen. * * @param type $request * @param Admin_Model_DocumentEditSession $session */ public function continueEdit($request, $session = null) { $addedPersons = $session->retrievePersons(); if (count($addedPersons) == 0) { $action = $request->getParam('continue', null); if ($action === 'addperson') { $personId = $request->getParam('person', null); if (!is_null($personId)) { $addedPersons[] = array('person' => $personId, 'role' => $request->getParam('role', 'author'), 'contact' => $request->getParam('contact', 'false'), 'order' => $request->getParam('order', null)); } else { $this->getLog()->err(__METHOD__ . ' Attempt to add person without ID.'); } } } foreach ($addedPersons as $person) { $this->addPerson($person); } }