خرید بک لینک

Vote count: 0

i don't know how to handle the request in my controller in symfony in the php code. So im creating a new model in my collection with collection.create() method but I don't know how to handle it in symfony php code. Can anyone help me?

Collection.create() code:

save: function()
    {            
            this.collection.create({
                    title: $("#title").val()
            });
            console.log(this.collection);
    }

PHP code:

/**
     * @Route("/document")
    */
    public function createAction(Request $request)
    {
    $content = $request->getContent();

    $document = new Document();

    $em = $this->getDoctrine()->getManager();

    $em->persist($document);

    $em->flush();

    retu new JsonResponse($document);
}

Request method: POST, status: OK

asked 50 secs ago

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 10 تير 1395 ساعت: 17:48

صفحه بندی