Welcome Guest, Not a member yet? Register   Sign In
Builder *and* beforeInert beforeUpdate
#3

I'm not looking to extend the database functionality, I'm looking to be able to use the beforeInsert from the database model while using the builder functionality.  I believe I want to extend the BaseBuilder class in the System/Database folder.

So far, this isn't working:

PHP Code:
<?php

namespace App\Libraries;

use 
CodeIgniter\Database;

class 
BaseBuilder extends BaseBuilder {
    public function insert(array $set nullbool $escape null)
    {
        log_message("error","IN EXTENDED BASE BUILDER");
        if ($set !== null)
        {
            $this->set($set''$escape);
        }

        if ($this->validateInsert() === false)
        {
            return false;
        }

        $sql $this->_insert(
            $this->db->protectIdentifiers(
                $this->QBFrom[0], true$escapefalse
            
), array_keys($this->QBSet), array_values($this->QBSet)
        );

        if (! $this->testMode)
        {
            $this->resetWrite();

            $result $this->db->query($sql$this->bindsfalse);

            // Clear our binds so we don't eat up memory
            $this->binds = [];

            return $result;
        }

        return false;
    }


I'm not seeing my log message in what I believe should be an overwritten class function (according to Extending Core Classes in the docs)
Reply


Messages In This Thread
RE: Builder *and* beforeInert beforeUpdate - by Kaosweaver - 06-23-2022, 04:23 AM



Theme © iAndrew 2016 - Forum software by © MyBB