Created
July 27, 2017 15:52
-
-
Save CarlosEduardo/6b69fa6650b43c966a0e1d0d794dfa68 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// "NativeQuery" like http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/native-sql.html | |
$nativeQuery = 'SELECT user.id AS id, user.name AS name, address.id AS address_id, address.street AS street, address.city AS city ' . | |
'FROM user INNER JOIN address ON address.id = user.address_id ' . | |
'WHERE user.name = :name'; | |
$atlas | |
->nativeQuery($nativeQuery) | |
->bindValue('name', 'romanb') | |
->addMapper(UserMapper::class, 'user', ['id', 'name']) | |
->addMapper(AddressMapper::class, 'address', ['address_id' => 'id', 'street', 'city']) | |
->fetchAll(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment