<?php // DO NOT EDIT THIS FILE. // This file was generated by searchgen. // If you need to customize this file, please edit the corresponding // yaml file in the gencfg directory, and then re-generate this file // by running searchgen, passing in the table name. if (isset($command) && $command == 'loadAppuser') { header('Content-Type: application/json'); $db = ConnectionFactory::getConnection(); $appuserDAO = new AppuserDAO($db); $approleDAO = new ApproleDAO($db); $id = isset($params['id']) ? (int) trim($params['id']) : 0; if ($id <= 0) { $rows = array(Appuser::createDefault()); } else { $sql = <<<EOF select * from appuser pri where pri.id = ? EOF; $ps = new PreparedStatement($sql, 0, 1); $ps->setInt($id); $rows = $appuserDAO->findWithPreparedStatement($ps); } $ps1 = new PreparedStatement(<<<EOF select distinct r.* from appuserrole u_r inner join approle r on r.role_name = u_r.role_name where u_r.user_id = ? order by r.sort_order, r.role_name EOF , 0, 0); foreach ($rows as &$row) { $ps1->clearParams(); $ps1->setInt($row->id); $row->roles = $id <= 0 ? array() : $approleDAO->findWithPreparedStatement($ps1);