/** * Adds the minimum requirements for being able to take part in an exam. * * Called when this component receives an HTTP POST request to * /approvalcondition(/). * The request body should contain a JSON object representing the * approvalCondition's attributes. */ public function addApprovalCondition($callName, $input, $params = array()) { $positive = function ($input) { // sets the new auto-increment id $obj = new ApprovalCondition(); $obj->setId($input[0]->getInsertId()); return array("status" => 201, "content" => $obj); }; return $this->_component->callSqlTemplate('out', dirname(__FILE__) . '/Sql/AddApprovalCondition.sql', array('values' => $input->getInsertData()), 201, $positive, array(), 'Model::isProblem', array(new ApprovalCondition())); }