Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AbstractRecord::delete() only returns false #906

Closed
MichaelGatesDev opened this issue Mar 1, 2020 · 0 comments
Closed

AbstractRecord::delete() only returns false #906

MichaelGatesDev opened this issue Mar 1, 2020 · 0 comments

Comments

@MichaelGatesDev
Copy link

In AbstractRecord.php, the delete function only ever returns false. I believe this an oversight.

    /**
     * Delete the record.
     */
    public function delete()
    {
        if ($this->_locked) {
            throw new Omeka_Record_Exception('Cannot delete a locked record!');
        }

        if (!$this->exists()) {
            return false;
        }

        $this->runCallbacks('beforeDelete');

        // Delete has an extra template method that is separate from the
        // callbacks. This is because the callbacks execute prior to actually
        // deleting anything. So the state of the record must be maintained
        // until all callbacks are done. Then _delete() template method takes
        // over and all bets are off
        $this->_delete();

        // The main delete query
        $table = $this->getTable()->getTableName();
        $this->getDb()->delete($table, 'id = '  . (int) $this->id);

        $this->runCallbacks('afterDelete');
        $this->id = null;
        // probably should return true here
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant