Tony Mucci

Photo by Joshua Hoehne on Unsplash

THE ISSUE

I came across another Segmentation Fault error when trying to run this code:

$example = ExampleModel::findFirst(CONDITIONS_EXAMPLE_HERE)$related_model = $example->getExampleModelName([
'conditions'=>'zip_code=?1',
'bind'=>[1=>90210]
]);

THE SOLUTION

In Phalcon 4, it seems that you are unable to use indexed bind parameters and instead have to use named parameters. The following code should work for you:

$example = ExampleModel::findFirst(CONDITIONS_EXAMPLE_HERE)$related_model = $example->getExampleModelName([
'conditions'=>'zip_code=:namedBindParameterHere:',
'bind'=>['namedBindParameterHere'=>90210]
]);

Happy Coding!

--

--

Tony Mucci

Tony Mucci

Founder of My Company Tools • Co-Founder/CTO of Dree • Co-Founder of Eklect Enterprises. Opinions on this blog are my own.