magnusbilling7 icon indicating copy to clipboard operation
magnusbilling7 copied to clipboard

Fix: [Removes use of count() on result of find()

Open vivaEspanaDelMu opened this issue 1 year ago • 0 comments
trafficstars

Status

READY

Migrations

NO

Description

The find() function on the Yii models return an object or null, and none of these implement Countable, thus count() will fail and the code will not be able to continue. The change in this makes sure that the object is compared in the if statement to give the wanted result, as in True if it is a valid object or False in case of null. Since we do not expect there to be more than one object (which is probably why find was used and not findAll or similar) it makes sense to not check count anyway.

Testing

Tested: Yes, against ca0215e

vivaEspanaDelMu avatar Sep 06 '24 07:09 vivaEspanaDelMu