-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom function execution on insert/update for field #44
Comments
There are no built in converters yet for these kind of types. You have to write your own converter class (see |
Problem not in converter itself (I have already created some of them). Let me explain
This means that field can be mapped to only one value. You use some workaround for Geometry types through additional Types (e.g. lib/Converter/Type/Point.php), but i my situation I want to use PG methods in fields definition (method call shouldn't be escaped) and escape two values (you use regexp to check values). Thank you |
I think I understand. For now, basic query methods only accept values as parameters. If you want to use Postgresql's functions in your statements, you will have to write the query yourself in dedicated methods in the according Model class like the following: public function updateSomething(Point $point)
{
$sql = <<<SQL
update my_table set a_field = ST_PointFromText($*::point) where … returning :projection
SQL;
…
} Is that what you want ? |
So I can't use builtin methods like insertOne/updateOne and should write own custom sql? |
For now yes. It used to be a |
Hi there
I have geometry field, i.e. ->addField('location', 'public.geometry')
and I want to make converting from text to geometry type on insert/update (but question is in general. this concrete situation is only an example). So the only solution I found is something like this
But it has drawbacks as two values are passed as single one so I can't separately escape each of them. The same situation with creation of of custom converter + I can't pass function with single quote in it.
Maybe you know more elegant way to implement such on-fly converting of several values with functions
Thanks you
The text was updated successfully, but these errors were encountered: