Using Oracle TO_DATE with Phalcon

We are converting a Zend Framework app to use phalcon and I am having a problem executing Oracle functions. In Zend, I would just do this: ```php "BASEPRICEDATE" => new ZendDbExpr("TODATE('" . $data["dateIntroduced"] . "', 'mm/dd/yyyy')") ``` Since I can't find a similar functionality in Phalcon, I tried the following: ```php "BASEPRICEDATE" => "TODATE(" . $data["basePriceDate"] . ", 'mm/dd/yyyy')" ``` Which doesn't work. I get the following error, which I have run into before, so I know it is from trying to update the date field: ```sql ORA-01858: a non-numeric character was found where a numeric was expected ``` And I am logging the database, which helps in a lot of cases, except it seems with bind variables and I get this in the log: ```sh [Fri, 06 Dec 13 10:19:03 -0600][INFO] UPDATE "MODELINSTANCE" SET "EQUIPMENTSUBTYPESIZEID" = ?, "MODELYEARFROM" = ?, "MODELYEARTO" = ?, "PUBLISHPRICEFLAG" = ?, "MODELID" = ?, "MODELTYPEID" = ?, "BASEPRICE" = ?, "BASEWEIGHT" = ?, "BASEPRICEDATE" = ?, "BASEPRICESOURCEID" = ?, "CONFIGPRICE" = ?, "CONFIGWEIGHT" = ?, "UPDATEDUSERID" = ? WHERE MODEL_INSTANCE.ID = 170169 ``` Which is useless in this case

Here is the full code below: ```php $updateData = array( "EQUIPMENTSUBTYPESIZEID" => $classification->child->child->child->id, //"DATEINTRODUCED" => "TODATE('" . $data["dateIntroduced"] . "', 'mm/dd/yyyy')", //"DATEDISCONTINUED" => "TODATE('" . $data["dateDiscontinued"] . "', 'mm/dd/yyyy')", "MODELYEARFROM" => $data["modelYearFrom"], "MODELYEARTO" => $data["modelYearTo"], "PUBLISHPRICEFLAG" => $data["publishPriceFlag"], "MODELID" => $modelId, "MODELTYPEID" => 1, "BASEPRICE" => $data["basePrice"], "BASEWEIGHT" => $data["baseWeight"], "BASEPRICEDATE" => "TODATE(" . $data["basePriceDate"] . ", 'mm/dd/yyyy')", "BASEPRICESOURCEID" => $data["basePriceSource"], "CONFIGPRICE" => $data["configuredPrice"], "CONFIGWEIGHT" => $data["configuredWeight"], //"CONFIGPRICEDATE" => "TODATE('" . $data["configuredPriceDate"] . "', 'mm/dd/yyyy')", //"CONFIGPRICESOURCEID" => $data["configuredPriceSource"], "UPDATEDUSERID" => $data["userId"] );

        $result = $db->update(
            "MODEL_INSTANCE",
            array_keys($updateData),
            array_values($updateData),
            "MODEL_INSTANCE.ID = $modelInstanceId"
        );

``` Is there anyone who can point me in the right direction to either debug this or use to_date with Oracle from Phalcon.

I think after hunting for an hour then finally posting here, I found it.

Replace 'new ZendDbExpr' with 'new \Phalcon\Db\RawValue' and I think it works.

Reposting here in case anyone else has troubles.

Thanks for this! I'm preparing to convert a non-frameworked app that interfaces with Oracle to Phalcon so I definitely will come across this issue.