500 Error with simple PUT or PATCH kickstarter example

Issue #45 closed
Kai Broenstrup created an issue

Hi, i just tried to use the “kickstarter” function. I changed the putIndexAction to a patchIndexAction - and it is not working. I always get a 500 error if i test that. I am on PHP 8.0 and Typo3 11.5.

This is the basic putIndexAction

public function patchIndexAction( EntryModel $entry = null, int $uid = null )
    {
        if (!$uid) {
            return $this->response->notFound("No uid passed in URL. Send the request with `api/entry/{uid}`");
        }
        if (!$entry) {
            return $this->response->notFound("Example with uid [{$uid}] was not found.");
        }

        $this->entryRepository->update( $entry );
        \nn\t3::Db()->persistAll();

        return $entry;
    }

If i debug the $entry i get the correct model with only my changed arguments which i put in the json. But than the ->update($entry) throws the 500 error.

In the description of the put example is mentioned that “You only need to set the fields in the JSON that should be updated". Is that correct for PUT? Not the complete JSON with all fields of the model?

Any ideas?

Comments (4)

  1. Log in to comment