即使在给定表中保存数据后,PostgreSQL也返回42P01

时间:2018-07-20 09:27:17

标签: php postgresql orm slim datamapper

我正在使用SPOT ORM和PHP的苗条框架。

$new_payment["payment_method"] = 'paytm';
 $new_payment["created_at"] = $date;
        $new_payment["payment_link"] = $url;
        $new_payment["payment_status"] = "started";
        $new_payment["request_id"] = $request_id;
        $new_payment["qr_data"] = $qr_data;
        $new_payment["extra_data"] = $curlResponse->response;
        $new_payment["amount"] = $amount;
        $new_payment["machine_id"] = $machine_id;
    $payment_info = new Payment_Info($new_payment);
    $is_success = $this->spot->mapper("App\Payment_Info")->save($payment_info);

以上语句将$new_payment对象保存在payment_info表中,但它返回了status code:42P01

我的Payment_Info班级-

    class Payment_Info extends \Spot\Entity
{
    protected static $table = "payment_info";

    public static function fields()
    {
        return [
            "payment_info_id" => ["type" => "bigint", "unsigned" => true, "primary" => true, "autoincrement" => true],//Primary key <tablename>_id 
            "created_at" => ["type" => "datetime", "required" => true, "value" => new \DateTime()], // Creation timestamp
            "payment_method" => ["type" => "string", "required" => true], // ["PayTm","UPI","MSwipe",etc]
            "payment_link" => ["type" => "text"], // payment link of selected method on which payment is done
            "payment_status" => ["type" => "string", "required" => true], // ["completed","cancelled"]
            "request_id" => ["type" => "bigint", "required" => true], //Request Id against which the payment info was generated
            "qr_data" => ["type" => "text"],//qr data or any other specific data that is requied to complete the payment
            "extra_data" => ["type" => "json_array"], //Extra data recieved after payment completion
            "amount" => ["type" => "float"], //Amount for which the payment info was generated
            "machine_id" => ["type" => "bigint", "required" => true]
        ];
    }

    public static function relations(Mapper $mapper, Entity $entity){
        return [
            "Request" => $mapper->belongsTo($entity, 'App\Request','request_id')
        ];
    }
}

我得到的答复:

Fatal error:  Uncaught InvalidArgumentException: Invalid HTTP status code in /Users/apple/Desktop/wendor/instabox-api/vendor/slim/slim/Slim/Http/Response.php:222
Stack trace:
#0 /Users/apple/Desktop/wendor/instabox-api/vendor/slim/slim/Slim/Http/Response.php(191): Slim\Http\Response->filterStatus('42P01')
#1 /Users/apple/Desktop/wendor/instabox-api/src/Slim/Handlers/ApiError.php(48): Slim\Http\Response->withStatus('42P01')
#2 [internal function]: Slim\Handlers\ApiError->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response), Object(PDOException))
#3 /Users/apple/Desktop/wendor/instabox-api/vendor/slim/slim/Slim/App.php(665): call_user_func_array(Object(Slim\Handlers\ApiError), Array)
#4 /Users/apple/Desktop/wendor/instabox-api/vendor/slim/slim/Slim/App.php(390): Slim\App->handleException(Object(PDOException), Object(Slim\Http\Request), Object(Slim\Http\Response))
#5 /Users/apple/Desktop/wendor/instabox-api/vendor/slim/slim/Slim/App.php(296): Slim\App->process(Object(Slim\Http\Request), Object(Slim\Http\Response))
in /Users/apple/Desktop/wendor/instabox-api/vendor/slim/slim/Slim/Http/Response.php on line 222

0 个答案:

没有答案