tryLoadAny() public method

Will not throw exception if record doesn't exist.
public tryLoadAny ( )
コード例 #1
0
ファイル: ExpressionSQLTest.php プロジェクト: atk4/data
 public function testNakedExpression()
 {
     $db = new Persistence_SQL($this->db->connection);
     $m = new Model($db, false);
     $m->addExpression('x', '2+3');
     $m->tryLoadAny();
     $this->assertEquals(5, $m['x']);
 }
コード例 #2
0
ファイル: TypecastingTest.php プロジェクト: atk4/data
 public function testTryLoadAny()
 {
     $a = ['types' => [['date' => '2013-02-20']]];
     $this->setDB($a);
     $db = new Persistence_SQL($this->db->connection);
     $m = new Model($db, ['table' => 'types']);
     $m->addField('date', ['type' => 'date', 'dateTimeClass' => '\\atk4\\data\\tests\\MyDate']);
     $m->tryLoadAny();
     $this->assertTrue($m['date'] instanceof MyDate);
 }
コード例 #3
0
ファイル: IteratorTest.php プロジェクト: atk4/data
 /**
  * Model is not associated with any database - persistence should be set.
  *
  * @expectedException Exception
  */
 public function testException3()
 {
     $m = new Model();
     $m->tryLoadAny();
 }