Skip to content
Permalink
Browse files

Code refactoring due to comments @ #8824 (comment)

  • Loading branch information...
Antoniossss committed May 15, 2016
1 parent 456c6fc commit 7727e202cc1a0b5302189bc768dd8372d98192ea

This file was deleted.

Oops, something went wrong.
@@ -59,6 +59,7 @@ public function __construct(Table $table)
* Build the map of property => association names.
*
* @param array $options List of options containing the 'associated' key.
* @throws \InvalidArgumentException
* @return array
*/
protected function _buildPropertyMap($options)
@@ -78,11 +79,10 @@ protected function _buildPropertyMap($options)
$assoc = $this->_table->association($key);
if ($assoc) {
$map[$assoc->property()] = ['association' => $assoc] + $nested + ['associated' => []];
} else {
if (substr($key, 0, 1) !== "_") { // if $key is a special underscored field eg _ids or _joinData
throw new MissingAssociationException([$this->_table->alias(), $key]);
}
continue;
}
if (substr($key, 0, 1) !== "_") { // if $key is not a special underscored field eg _ids or _joinData
throw new \InvalidArgumentException(vsprintf("%s is not associated with %s",[$this->_table->alias(), $key]));
}
}
return $map;
@@ -1135,10 +1135,11 @@ public function testManyAssociations()
/**
* Test if exceptin is raised when called with [associated=>NonExistingAssociation]
* Previously such association has been simply ignored
* @expectedException \InvalidArgumentException
* @return void
*/
public function testManyInvalidAssociation()
{
$this->expectException(MissingAssociationException::class);
$data = [
[
'comment' => 'First post',
@@ -1156,7 +1157,7 @@ public function testManyInvalidAssociation()
],
];
$marshall = new Marshaller($this->comments);
$result = $marshall->many($data, ['associated' => ['Users','People']]);
$marshall->many($data, ['associated' => ['Users','People']]);
}
/**

0 comments on commit 7727e20

Please sign in to comment.
You can’t perform that action at this time.