コード例 #1
0
 function testFindOneAlias()
 {
     $object1 = $this->creator->createOneTableObject();
     $object2 = $this->creator->createOneTableObject();
     $this->assertFalse($object2->isNew());
     $found = lmbActiveRecord::findOne('TestOneTableObject', lmbActiveRecord::getDefaultConnection()->quoteIdentifier("id") . '=' . $object1->getId());
     $this->assertEqual($found->get('annotation'), $object1->get('annotation'));
     $this->assertEqual($found->get('content'), $object1->get('content'));
     $this->assertEqual($found->get('news_date'), $object1->get('news_date'));
     $this->assertEqual($found->get('id'), $object1->getId());
     //testing convenient alias
     $found = TestOneTableObject::findOne(lmbActiveRecord::getDefaultConnection()->quoteIdentifier("id") . '=' . $object1->getId());
     $this->assertEqual($found->get('annotation'), $object1->get('annotation'));
     $this->assertEqual($found->get('content'), $object1->get('content'));
     $this->assertEqual($found->get('news_date'), $object1->get('news_date'));
     $this->assertEqual($found->get('id'), $object1->getId());
 }