michalsn / codeigniter4-uuid

UUID package for CodeIgniter 4 with support for Model and Entity.
MIT License
41 stars 9 forks source link

find is not working after insert #4

Closed tedbrunelle closed 3 years ago

tedbrunelle commented 3 years ago

once I insert data and then tries to find that record with find method by providing primary key returned by insert call, It returns all the records $model = new CommoditiesModel(); $commodity = $model->insert($input); $commodity_data = $model->find($commodity);

find call is returning all the records without any WHERE clause.

michalsn commented 3 years ago

That is strange since we have tests for this method in place: https://github.com/michalsn/codeigniter4-uuid/blob/develop/tests/UuidModelTest.php#L94

I will try to revisit the model class after changes introduced to the v4.1, but I can't promise when.

tedbrunelle commented 3 years ago

Thanks, I found the problem. It's not in the library. I have to typecast $commodity variable to string $commodity_data = $model->find((string)$commodity);

It worked for me