Skip to content

Commit 554b118

Browse files
committed
Merge pull request #56 from dovg/metaPropertyBug
+ test for lazy encapsulant added. + new implementation of encapsulant getId added
2 parents 0e262ae + 6264e9f commit 554b118

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

doc/ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2011-11-21 Alexey S. Denisov, Evgeny V. Kokovikhin
2+
3+
* meta/types/ObjectType.class.php, test/misc/DAOTest.class.php: changed logic
4+
for getObjectId method of lazy encapsulant; test for lazy logic added
5+
16
2011-11-29 Igor V. Gulyaev
27

38
* test/main/ViewTest.class.php: added View test

meta/types/ObjectType.class.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,9 @@ public function {$methodName}()
121121
122122
public function {$methodName}Id()
123123
{
124-
return \$this->{$name}Id;
124+
return \$this->{$name}
125+
? \$this->{$name}->getId()
126+
: \$this->{$name}Id;
125127
}
126128
127129
EOT;

test/misc/DAOTest.class.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -826,6 +826,30 @@ public function testIpRangeProperty()
826826
$this->drop();
827827
}
828828

829+
public function testLazy()
830+
{
831+
$this->create();
832+
833+
$parent = TestParentObject::create();
834+
$child = TestChildObject::create()->setParent($parent);
835+
836+
$parent->dao()->add($parent);
837+
838+
$child->dao()->add($child);
839+
840+
$this->assertEquals(
841+
$parent->getId(),
842+
Criteria::create(TestChildObject::dao())->
843+
setProjection(
844+
Projection::property('parent.id', 'parentId')
845+
)->
846+
add(Expression::eq('id', $child->getId()))->
847+
getCustom('parentId')
848+
);
849+
850+
$this->drop();
851+
}
852+
829853
protected function getSome()
830854
{
831855
for ($i = 1; $i < 3; ++$i) {

0 commit comments

Comments
 (0)