Skip to content

Commit

Permalink
More work towards marking entities with their source
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Mar 16, 2014
1 parent d36c5f4 commit b83bea9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/ORM/ResultSet.php
Expand Up @@ -381,11 +381,11 @@ protected function _groupResult($row) {
if (!isset($results[$alias])) {
continue;
}
$target = $instance->target();
$instance = $assoc['instance'];
$target = $instance->target();
$results[$alias] = $this->_castValues($target, $results[$alias]);
$options['source'] = [
'alias' => $instance->alias(),
'alias' => $target->alias(),
'className' => get_class($target)
];

Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase/View/Helper/FormHelperTest.php
Expand Up @@ -1691,7 +1691,7 @@ public function testFormValidationAssociated() {
$nested = new Entity(['foo' => 'bar']);
$nested->errors('foo', ['not a valid bar']);
$entity = new Entity(['nested' => $nested]);
$this->Form->create($entity);
$this->Form->create($entity, ['context' => ['table' => 'Articles']]);

$result = $this->Form->error('nested.foo');
$this->assertEquals('<div class="error-message">not a valid bar</div>', $result);
Expand All @@ -1709,7 +1709,7 @@ public function testFormValidationAssociatedSecondLevel() {
$nested = new Entity(['foo' => $inner]);
$entity = new Entity(['nested' => $nested]);
$inner->errors('bar', ['not a valid one']);
$this->Form->create($entity);
$this->Form->create($entity, ['context' => ['table' => 'Articles']]);
$result = $this->Form->error('nested.foo.bar');
$this->assertEquals('<div class="error-message">not a valid one</div>', $result);
}
Expand Down

0 comments on commit b83bea9

Please sign in to comment.