Hey can someone help me out with this? I’m trying to use a Phalcon query to insert models. Here is my code:
$phql = "INSERT INTO CompanyModel (
name,
about,
current_average_rating,
timestamp_updated,
timestamp_expires,
type,
profile_picture,
address_line_1,
address_line_2,
address_city,
address_state,
address_zip,
lat,
lon,
point,
phone
)
VALUES (
:name:,
NULL,
:current_average_rating:,
DEFAULT,
DEFAULT,
:type:,
NULL,
:address_line_1:,
:address_line_2:,
:address_city:,
:address_state:,
:address_zip:,
:lat:,
:lon:,
ST_GEOMFROMTEXT('POINT({$companyArray['lon'] {$companyArray['lat']})'),
:phone:
)";
$query = $this->modelsManager->executeQuery($phql, $companyArray);
return $this->sendResponse($query);
but I keep getting this error:
Exception The argument is not initialized or iterable()
phalcon/mvc/model/query.zep:281 Phalcon\Mvc\Model\Query::_getQualified
[internal] Phalcon\Mvc\Model\Query::_getExpression
[internal] Phalcon\Mvc\Model\Query::_prepareInsert
[internal] Phalcon\Mvc\Model\Query::parse
[internal] Phalcon\Mvc\Model\Query::execute
[internal] Phalcon\Mvc\Model\Manager::executeQuery
It’s failing on the $query = $this->modelsManager->executeQuery($phql, $companyArray);
line.
I’ve verified that $companyArray
is actually an array and has all the necessary attrs to bind.
Please help!