@@ -4,7 +4,7 @@ Advanced field value conversion using custom mapping types
44..
sectionauthor ::
Jan Sorgalla <[email protected] > 55
66When creating entities, you sometimes have the need to transform field values
7- before they are saved to the database. In Doctrine you can use Custom Mapping
7+ before they are saved to the database. In Doctrine you can use Custom Mapping
88Types to solve this (see: :ref: `reference-basic-mapping-custom-mapping-types `).
99
1010There are several ways to achieve this: converting the value inside the Type
@@ -15,7 +15,7 @@ type `Point <https://dev.mysql.com/doc/refman/8.0/en/gis-class-point.html>`_.
1515
1616The ``Point `` type is part of the `Spatial extension <https://dev.mysql.com/doc/refman/8.0/en/spatial-extensions.html >`_
1717of MySQL and enables you to store a single location in a coordinate space by
18- using x and y coordinates. You can use the Point type to store a
18+ using x and y coordinates. You can use the Point type to store a
1919longitude/latitude pair to represent a geographic location.
2020
2121The entity
@@ -29,9 +29,9 @@ The entity class:
2929.. code-block :: php
3030
3131 <?php
32-
32+
3333 namespace Geo\Entity;
34-
34+
3535 /**
3636 * @Entity
3737 */
@@ -84,15 +84,15 @@ The entity class:
8484 }
8585 }
8686
87- We use the custom type ``point `` in the ``@Column `` docblock annotation of the
87+ We use the custom type ``point `` in the ``@Column `` docblock annotation of the
8888``$point `` field. We will create this custom mapping type in the next chapter.
8989
9090The point class:
9191
9292.. code-block :: php
9393
9494 <?php
95-
95+
9696 namespace Geo\ValueObject;
9797
9898 class Point
@@ -196,7 +196,7 @@ The format of the string representation format is called
196196`Well-known text (WKT) <https://en.wikipedia.org/wiki/Well-known_text >`_.
197197The advantage of this format is, that it is both human readable and parsable by MySQL.
198198
199- Internally, MySQL stores geometry values in a binary format that is not
199+ Internally, MySQL stores geometry values in a binary format that is not
200200identical to the WKT format. So, we need to let MySQL transform the WKT
201201representation into its internal format.
202202
@@ -210,13 +210,13 @@ which convert WKT strings to and from the internal format of MySQL.
210210
211211.. note ::
212212
213- When using DQL queries, the ``convertToPHPValueSQL `` and
213+ When using DQL queries, the ``convertToPHPValueSQL `` and
214214 ``convertToDatabaseValueSQL `` methods only apply to identification variables
215- and path expressions in SELECT clauses. Expressions in WHERE clauses are
215+ and path expressions in SELECT clauses. Expressions in WHERE clauses are
216216 **not ** wrapped!
217217
218218 If you want to use Point values in WHERE clauses, you have to implement a
219- :doc: `user defined function <dql-user-defined-functions >` for
219+ :doc: `user defined function <dql-user-defined-functions >` for
220220 ``PointFromText ``.
221221
222222Example usage
@@ -252,5 +252,5 @@ Example usage
252252 $query = $em->createQuery("SELECT l FROM Geo\Entity\Location l WHERE l.address = '1600 Amphitheatre Parkway, Mountain View, CA'");
253253 $location = $query->getSingleResult();
254254
255- /* @var Geo\ValueObject\Point */
255+ /** @var Geo\ValueObject\Point */
256256 $point = $location->getPoint();
0 commit comments