Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Illegal offset type in idiorm.php on line 2028 #233

Closed
chihlongliu-zz opened this issue Sep 12, 2014 · 3 comments
Closed

Illegal offset type in idiorm.php on line 2028 #233

chihlongliu-zz opened this issue Sep 12, 2014 · 3 comments

Comments

@chihlongliu-zz
Copy link

When using compound keys with id_column_overrides, I get some illegal offset type warnings with PHP 5.3.3. On line 2026, taking the array slice of the column still results in an array (with the single element that was sliced out from $column). Using $column[0] = $column seems to fix this problem.

However, when I run it, $db->lastInsertId() is undefined, and even if I hard code $this->_data[$column] to a set value (e.g. 30), saving it won't set the id value to 30. (actually, if creating a new record in this context, the database autoincrements the value correctly, so I'm not sure if lastInsertId() is even needed)

Lastly, I also ran into the illegal offset type problem on line 1892 (under _get_id_column_name()). The current workaround I found was to explicitly define in id_column_overrides all id columns for all tables, even if the table only had a single primary key with name 'id'.

@lrlopez
Copy link
Contributor

lrlopez commented Sep 14, 2014

Thanks for reporting! I'll take a look into these issues ASAP

lrlopez added a commit to lrlopez/idiorm that referenced this issue Sep 20, 2014
When using autoincremented compound keys, an insert operation
would not update the autoincremented value into the object.

Fixes j4mie#233
lrlopez added a commit to lrlopez/idiorm that referenced this issue Sep 20, 2014
When inserting new records on a autoincremented compound keys table, a
bug would prevent updating the autoincremented value.

Fixes j4mie#233
@lrlopez
Copy link
Contributor

lrlopez commented Sep 20, 2014

@chihlongliu, please have a look into PR #235

Can you test this patch against your code? It should fix your problems. If it doesn't, just drop me a line.

@treffynnon
Copy link
Collaborator

Fix merged in develop. Thanks!

Repository owner locked and limited conversation to collaborators Dec 14, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants