Skip to content
Permalink
Browse files

Fixed the findFirstBy*

  • Loading branch information...
niden committed May 17, 2019
1 parent a894db1 commit cc8cd54942cdeed368ecd6cf159ed754da04ba42
Showing with 18 additions and 11 deletions.
  1. +1 −11 phalcon/Mvc/Model.zep
  2. +17 −0 tests/integration/Mvc/Model/FindFirstCest.php
@@ -228,17 +228,7 @@ abstract class Model implements EntityInterface, ModelInterface, ResultInterface
*/
public static function __callStatic(string method, array arguments)
{
var records;

let records = self::_invokeFinder(method, arguments);

if unlikely records === null {
throw new Exception(
"The static method '" . method . "' doesn't exist"
);
}

return records;
return self::_invokeFinder(method, arguments);
}


@@ -15,6 +15,7 @@
use IntegrationTester;
use Phalcon\Mvc\Model\Exception;
use Phalcon\Test\Fixtures\Traits\DiTrait;
use Phalcon\Test\Models\Customers;
use Phalcon\Test\Models\Robots;
use Phalcon\Test\Models\RobotsExtended;
@@ -71,6 +72,22 @@ public function mvcModelFindFirstNotFound(IntegrationTester $I)
$I->assertNull($robot);
}
/**
* Tests Phalcon\Mvc\Model :: findFirstBy() - not found
*
* @author Phalcon Team <team@phalconphp.com>
* @since 2018-11-13
*/
public function mvcModelFindFirstByNotFound(IntegrationTester $I)
{
$I->wantToTest('Mvc\Model - findFirstBy() - not found');
$this->setNewFactoryDefault();
$this->setDiMysql();
$robot = Customers::findFirstByEmail('unknown');
$I->assertNull($robot);
}
/**
* Tests Phalcon\Mvc\Model :: findFirst() - extended
*

0 comments on commit cc8cd54

Please sign in to comment.
You can’t perform that action at this time.