1

So i have a strange effect when trying moving a MVC component of mine to Joomla 4. I could break it down to a very simple test.

If you look at the \libraries\src\MVC\Model\AdminModel.php file around line 1180. This is part of the save method and happening after the row/table has been saved:

    if (isset($table->$key))
    {
        $this->setState($this->getName() . '.id', $table->$key);
    }

In Joomla 3 i can do this to get the id of the last saved row:

    if (isset($table->$key))
    {
        $this->setState($this->getName() . '.id', $table->$key);
        var_dump($this->getState($this->getName() . '.id'));
    }

If i do the same in Joomla 4 i always get a 0. Of course i do that in the model of my component. I use the id of the last inserted row to work with other tables. This breaks it down for a simple test.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.