Skip to content

Commit

Permalink
Fix docblock for PK generation and composite keys
Browse files Browse the repository at this point in the history
Ref: #4936 (comment)

Where it is being used actually assumes that it can be handled like an array by casting it.
```
$id = (array)$this->_newId($primary) + $keys;
```

Could this cast be moved into the _newId() method to make clear that you can return array of primary key values?
  • Loading branch information
inoas committed Feb 16, 2017
1 parent da93102 commit 6d626a6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/ORM/Table.php
Expand Up @@ -1923,8 +1923,11 @@ protected function _insert($entity, $data)
* value if possible. You can override this method if you have specific requirements
* for id generation.
*
* Note: The ORM will not generate primary key values for composite primary keys.
* You can overwrite _newId() in your table class.
*
* @param array $primary The primary key columns to get a new ID for.
* @return mixed Either null or the new primary key value.
* @return null|string|array Either null or the primary key value or a list of primary key values.
*/
protected function _newId($primary)
{
Expand Down

0 comments on commit 6d626a6

Please sign in to comment.