[Flow] Deadlock using RestService

Alexander Wende a_wende at web.de
Wed Jul 23 12:40:53 CEST 2014


I implemented the raptor editor (www.raptor-editor.com) to allow my users comfortable editing of a page model.
When the raptor editor saves the changes, it fires for every changed property an updatePageAction.

My updatePageAction looks like  this (atm it can only update the title or content property of the page object)
    /**
     * @param \COMPANY\Page\Domain\Model\Page $page
     * @param string $id the identifier for the modified property
     * @param string $content the new value of the modified property
     */
    public function updatePageAction(\COMPANY\Page\Domain\Model\Page $page,$id,$content){
        switch ($id){
            case 'content':
                $page->setContent($content);
                break;
            case 'title':
                $page->setTitle($content);
                break;
        }
        $this->pageRepository->update($page);
        return json_encode(true);

When I update only one property it works fine. But when I try to change title and content, the raptor editor fires two Request very fast. The first request is allways succesful. The second request failed every time with the Exception "SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction"

Is there a better way to build such RestServices?



More information about the Flow mailing list