Welcome Guest, Not a member yet? Register   Sign In
No Child Records 500 Error
#1
Wink 

I have a controller called Constituents. The following returns one Constituent record, as it should.
PHP Code:
$constituent $Model->find($id); 
I'm using entities, and have set the Constituent entity as the return type in the Constituent model.
Constituents have optional child records called Addresses, Phones, and Emails. In the controller, I call the following:
PHP Code:
$constituent->addresses $AddressModel->where'constituent_id'$id)->findAll(); 
In Postman, I GET request to the API endpoint in the Constituent controller. If there is no matching row in the Addresses table, I get nothing back in the response body and I get a 500 error. What is happening to cause this? I've even tried if blocks to test for empty model results and it still causes the same error. Basically, if there's no data in the table that matches, it freaks out. This can't be intentional in the feature set. Any solution ideas?

Thanks.
Reply
#2

I had a bad column schema. Fixed it.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB