Está en la página 1de 1

Resultado de entidades unidas El resultado una entidad unida describe un tipo de entidad que aparece como un e lemento unido

a la relacin en el resultado transformado, unido a un resultado entidad (raz). T agregas un result ado entidad unido a travs de ResultSetMapping#addJoinedEntityResult(). Vamos a echar un vistazo en detalle a la firma del mtodo: <?php /** * Aade una entidad unida al resultado. * * @param string $class El nombre de clase de la entidad unida. * @param string $alias El alias nico a usar por la entidad unida. * @param string $parentAlias The alias of the entity result that is the parent o f this joined result * @param object $relation The association field that connects the parent entity result with the join */ public function addJoinedEntityResult($class, $alias, $parentAlias, $relation) El primer parmetro es el nombre de clase de la entidad unida. El segundo parmetro es un alias arbitrario para la entidad unida, el cual debe ser nico dentro del ResultSetMapping. Puedes utilizar este alias para asignar los resultados a la entidad resultante. El tercer parmetro es el alias de la entidad resultante que es el tipo del padre de la relacin unida. The fourth and last parameter is the name of the field on the pare nt entity result that should contain the joined entity result. Field results A field result describes the mapping of a single column in an SQL result set to a field in an entity. As such, field results are inherently bound to entity results. You add a field result through ResultSet Mapping#addFieldResult(). Again, let's examine the method signature in detail: <?php /** * Adds a field result that is part of an entity result or joined entity result. * * @param string $alias The alias of the entity result or joined entity result. * @param string $columnName The name of the column in the SQL result set. * @param string $fieldName The name of the field on the (joined) entity. */ public function addFieldResult($alias, $columnName, $fieldName) The first parameter is the alias of the entity result to which the field result will belong. The second parameter is the name of the column in the SQL result set. Note that this name is case sensitive, i.e. if you use a native query against 118 Captulo 1. Gua de referencia

También podría gustarte