Skip to content

Commit

Permalink
Improving model config error messaging.
Browse files Browse the repository at this point in the history
 - Fixing issues with fixtures for Mongo relationship integration testing
  • Loading branch information
nateabele committed Dec 5, 2013
1 parent 4fde127 commit 2c4786b
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 1 deletion.
4 changes: 3 additions & 1 deletion data/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -1298,7 +1298,9 @@ public static function &connection() {
if ($conn = $connections::get($name)) {
return $conn;
}
throw new ConfigException("The data connection `{$name}` is not configured.");
$class = get_called_class();
$msg = "The data connection `{$name}` is not configured for model `{$class}`.";
throw new ConfigException($msg);
}

/**
Expand Down
16 changes: 16 additions & 0 deletions tests/fixture/model/gallery/Comments.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php
/**
* Lithium: the most rad php framework
*
* @copyright Copyright 2013, Union of RAD (http://union-of-rad.org)
* @license http://opensource.org/licenses/bsd-license.php The BSD License
*/

namespace lithium\tests\fixture\model\gallery;

class Comments extends \lithium\data\Model {

protected $_meta = array('connection' => 'test');
}

?>
1 change: 1 addition & 0 deletions tests/fixture/model/gallery/Galleries.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class Galleries extends \lithium\data\Model {

public $hasMany = array('Images');

protected $_meta = array('connection' => 'test');
}

?>
1 change: 1 addition & 0 deletions tests/fixture/model/gallery/Images.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class Images extends \lithium\data\Model {

public $hasMany = array('ImagesTags', 'Comments');

protected $_meta = array('connection' => 'test');
}

?>
1 change: 1 addition & 0 deletions tests/fixture/model/gallery/ImagesTags.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class ImagesTags extends \lithium\data\Model {

public $belongsTo = array('Images', 'Tags');

protected $_meta = array('connection' => 'test');
}

?>

0 comments on commit 2c4786b

Please sign in to comment.