Skip to content

ModelCriteria::delete() -> $this  #1616

Open
@spidfire

Description

@spidfire

I got an error not 100% sure it's a PHP compat issue but it does look like it

Details
Type: Error
Code: 0
Message: Using $this when not in object context
File:  ..../vendor/propel/propel/src/Propel/Runtime/ActiveQuery/ModelCriteria.php
Line: 1497
Trace
#0 ..../src/Models/Environment/Base/EnvironmentToServerQuery.php(700): Propel\Runtime\ActiveQuery\ModelCriteria::delete()

After some dive into the code I came across this issue:

It generates a static reference ModelCriteria::delete and inside this ref there is a test on if (0 === count($this->getMap())) { which refers to $this.

Generated code from a Base Query file:

    return $con->transaction(static function () use ($con, $criteria) {
            $affectedRows = 0; // initialize var to track total num of affected rows

            EnvironmentToServerTableMap::removeInstanceFromPool($criteria);

            $affectedRows += ModelCriteria::delete($con);
            EnvironmentToServerTableMap::clearRelatedInstancePool();

            return $affectedRows;
        });

\$affectedRows += ModelCriteria::delete(\$con);

if (0 === count($this->getMap())) {

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions