Skip to content
Permalink
Browse files

Clarify error message.

  • Loading branch information...
markstory committed Jul 25, 2014
1 parent a30633b commit c4b80d2f7d4f47e68baafaa2510d6c85ee19f609
Showing with 5 additions and 3 deletions.
  1. +4 −2 src/ORM/Table.php
  2. +1 −1 tests/TestCase/ORM/TableTest.php
@@ -1142,9 +1142,11 @@ public function save(EntityInterface $entity, $options = []) {
* @param \Cake\Datasource\EntityInterface $entity the entity to be saved
* @param array $options the options to use for the save operation
* @return \Cake\Datasource\EntityInterface|bool
* @throws \RuntimeException When an entity is missing some of the primary keys.
*/
protected function _processSave($entity, $options) {
$primary = $entity->extract((array)$this->primaryKey());
$primaryColumns = (array)$this->primaryKey();
$primary = $entity->extract($primaryColumns);
if ($primary && $entity->isNew()) {
$alias = $this->alias();
@@ -1232,7 +1234,7 @@ protected function _insert($entity, $data) {
$primary = (array)$this->primaryKey();
if (empty($primary)) {
$msg = sprintf(
'Cannot insert row in "%s", it has no primary key.',
'Cannot insert row in "%s" table, it has no primary key.',
$this->table()
);
throw new \RuntimeException($msg);
@@ -1369,7 +1369,7 @@ public function testAfterSaveNotCalled() {
*
* @group save
* @expectedException \RuntimeException
* @expectedExceptionMessage Cannot insert row in "users", it has no primary key
* @expectedExceptionMessage Cannot insert row in "users" table, it has no primary key
* @return void
*/
public function testSaveNewErrorOnNoPrimaryKey() {

0 comments on commit c4b80d2

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