Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Unset primary key when deleting model #6162

Closed
aschempp opened this issue Sep 7, 2013 · 4 comments
Closed

Unset primary key when deleting model #6162

aschempp opened this issue Sep 7, 2013 · 4 comments

Comments

@aschempp
Copy link
Member

aschempp commented Sep 7, 2013

A call to Model::delete should remove the primary key from arrData

@tristanlins
Copy link
Contributor

👍

@leofeyer
Copy link
Member

Should it not rather reset all data?

    public function delete()
    {
        $intAffected = \Database::getInstance()->prepare("DELETE FROM " . static::$strTable . " WHERE " . static::$strPk . "=?")
                                               ->execute($this->{static::$strPk})
                                               ->affectedRows;

        // Reset (see #6162)
        $this->arrData = array();
        $this->arrRelated = array();

        return $intAffected;
    }

@contao/workgroup-core

@aschempp
Copy link
Member Author

Not sure about that. I could still save the model again to create a new record (not sure if that makes sense though). Unfortunately we can't destroy the object...

@leofeyer
Copy link
Member

Fixed in 4903457.

ralfhartmann pushed a commit to ralfhartmann/core that referenced this issue Oct 1, 2013
ralfhartmann pushed a commit to ralfhartmann/core that referenced this issue Oct 2, 2013
ralfhartmann pushed a commit to ralfhartmann/core that referenced this issue Oct 2, 2013
ralfhartmann pushed a commit to ralfhartmann/core that referenced this issue Oct 2, 2013
ralfhartmann pushed a commit to ralfhartmann/core that referenced this issue Oct 2, 2013
ralfhartmann pushed a commit to ralfhartmann/core that referenced this issue Oct 2, 2013
ralfhartmann pushed a commit to ralfhartmann/core that referenced this issue Oct 2, 2013
ralfhartmann pushed a commit to ralfhartmann/core that referenced this issue Oct 2, 2013
ralfhartmann pushed a commit to ralfhartmann/core that referenced this issue Oct 3, 2013
ralfhartmann pushed a commit to ralfhartmann/core that referenced this issue Oct 3, 2013
ralfhartmann pushed a commit to ralfhartmann/core that referenced this issue Oct 3, 2013
ralfhartmann pushed a commit to ralfhartmann/core that referenced this issue Nov 6, 2013
ralfhartmann pushed a commit to ralfhartmann/core that referenced this issue Nov 6, 2013
ralfhartmann pushed a commit to ralfhartmann/core that referenced this issue Nov 6, 2013
ralfhartmann pushed a commit to ralfhartmann/core that referenced this issue Nov 6, 2013
ralfhartmann pushed a commit to ralfhartmann/core that referenced this issue Nov 6, 2013
ralfhartmann pushed a commit to ralfhartmann/core that referenced this issue Nov 6, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants