Skip to content

Improve DataMapper wasModified() behavior #2

@R4PH1

Description

@R4PH1

Hi,

love your database libraries. Unfortunately I cannot do a Pull request.

I have a few issues to report which you might be interested in:

Issue 1:
Opis\ORM\Core\DataMapper->setColumn()
When calling the function with the same value as already set previously I expect $orm->wasModified() to return false not true.

My "dirty fix" looks like that:

    public function setColumn(string $name, $value)
    {
           .....
           if (isset($this->rawColumns[$name])){        
                 if($this->rawColumns[$name] == $value){                   
                      return;
                }
           }
    
           $this->modified[$name] = 1;
           unset($this->columns[$name]);
           $this->rawColumns[$name] = $value;
    }

Issue 2:
some parts of the IDE auto completion do not work especially when querying from the orm object:
(Using netbeans 12.2)
$orm->query(test::CLASS)-> this works for most cases, get() does not work.
$orm->query(test::CLASS)->withSoftDeleted(true)-> limited only, no get() etc.
$orm->query(test::CLASS)->where(...)->like(...)-> not working at all

I found out changing some traits to public instead of protected does the thing. Don´t know if this is a change you want to do or not.

If nothing of this is in your interest, just close the issue.

Br

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions