protected final function __construct($collection_name, $entity_path) { // @TODO: check when $collection_name and $entity_path can be null parent::__construct($collection_name); $this->entityPath = $entity_path; if (TRUE === is_null($entity_path)) { throw new UserException('ENTITY_PATH is not set.'); } // @CAUTION $this->includeEntity(); $this->includeEntityBulk(); }
protected final function __construct($collection_name) { parent::__construct($collection_name); }
/** * @param int $execution_id * @param array $execution_record * @param int $status_code * @param boolean $close_cgi_only */ private final function respond($execution_id, $execution_record, $status_code, $close_cgi_only = FALSE) { if (FALSE === $close_cgi_only) { $this->result['database'] = []; if (2 !== $this->getCode()) { $this->result['database']['rollbacked'] = MDBC::rollback(); } else { $this->result['database']['rollbacked'] = FALSE; } $this->result['database']['changed'] = MDBC::isChanged(); Debug::updateExecutionRecord($execution_id, $execution_record); Debug::popExecutionId($execution_id); } if (FALSE === is_null($error = error_get_last()) and TRUE === Debug::isErrorCared($error)) { Debug::handleFatalError($error); } header('Content-Type : application/json', TRUE, $status_code); if (FALSE === Debug::isProduction()) { $this->result['monitor'] = Debug::getMonitor(); $this->result += Debug::getDebugInfo(); $this->result += ['size' => sprintf('%.2fKB', Kit::len(json_encode($this->result)) / 1024)]; if (TRUE === is_null($this->result['mainException'])) { unset($this->result['mainException']); } if (TRUE === is_null($this->result['monitor'])) { unset($this->result['monitor']); } } else { unset($this->result['mainException']); unset($this->result['monitor']); unset($this->result['database']); unset($this->result['process']); } Http::json($this->result); if (TRUE === $close_cgi_only) { fastcgi_finish_request(); // DO NOT exit in order to run the subsequent scripts. } else { exit; } }