TIP: Use Markdown or, <pre> for multi line code blocks / <code> for inline code.
Forums are in read-only mode while we transition to new software.
ORM::_build(Database::DELETE) in 3.2.0
  • Hi,

    This is related to the orm issue I reported here: http://dev.kohanaframework.org/issues/4177 . Basically I want to have a method in my models to delete_all(), without having to load the results and delete them one by one. Like $users->images->delete_all(); for example to build a query like

    DELETE FROM `images` WHERE `user_id` = 1;
    

    I am fine with something like Model_X extends Base_Model extends ORM where Base_Model has this delete_all() function:

    public function delete_all() {
        $this->_build(Database::DELETE);
        $this->_db_builder->execute($this->_db);
        return $this->clear();
    }
    

    My question is if there's any alternative to building the DB query without having ORM aliasing the table name (because DELETE FROM images as image throws a mysql error as explained in the issue).