/** * @param query $query * @return query */ public function execute($query) { $stmt = $this->resource->prepare($query->getQueryString()); foreach ($query->getArguments() as $value) { $stmt->bind_param($value['type'], $value['argument']); } $stmt->execute(); $result = $stmt->get_result(); $query->setResult($result->fetch_all())->setAffectedRows($stmt->affected_rows)->setInsertId($this->resource->insert_id); $stmt->close(); $result->close(); return $query; }