Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions doc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2011-11-21 Alexey S. Denisov, Evgeny V. Kokovikhin

* meta/types/ObjectType.class.php, test/misc/DAOTest.class.php: changed logic
for getObjectId method of lazy encapsulant; test for lazy logic added

2011-11-29 Igor V. Gulyaev

* test/main/ViewTest.class.php: added View test
Expand Down
4 changes: 3 additions & 1 deletion meta/types/ObjectType.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ public function {$methodName}()

public function {$methodName}Id()
{
return \$this->{$name}Id;
return \$this->{$name}
? \$this->{$name}->getId()
: \$this->{$name}Id;
}

EOT;
Expand Down
24 changes: 24 additions & 0 deletions test/misc/DAOTest.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,30 @@ public function testIpRangeProperty()
$this->drop();
}

public function testLazy()
{
$this->create();

$parent = TestParentObject::create();
$child = TestChildObject::create()->setParent($parent);

$parent->dao()->add($parent);

$child->dao()->add($child);

$this->assertEquals(
$parent->getId(),
Criteria::create(TestChildObject::dao())->
setProjection(
Projection::property('parent.id', 'parentId')
)->
add(Expression::eq('id', $child->getId()))->
getCustom('parentId')
);

$this->drop();
}

protected function getSome()
{
for ($i = 1; $i < 3; ++$i) {
Expand Down