We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

No able to delete object

When I call <?php $item->delete(); on a simple model, I get: "Exception: Trying to call method getshared on a non-object"

Delete function is not extended. What could possibly cause this?

php 7.3.16, phalcon 4.0.6 (Mac, installed with macports)

I have doubts that that line is what's causing the error.

getShared() is a method defined on Phalcon's Dependency Injector component. It looks like you're calling getShared(), but the DI container doesn't exist.

When trying to delete, Phalcon would access the DB service which is defined in the DI container, so that might be causing it. But Phalcon would have already accessed that when querying the DB to retrieve the item you're now deleting.

More code would help.



517

I resoved this issue.

Problem was, that one property/column in model table was called container. I guees this is a reserved word, but an error on creation or something like that would be much more useful not to make such "mistake".