Hi folks,

I've started to write some code around the Zend_Entity compontent, and I discovered something that I don't know if is a bug or is the desired behaviour.

I had and entity with a property named 'name' which is mapped to a column named 'nombre' by the entity definition. I need a query to return some entities ordered by name, so I wrote one with the Zend_Db_Mapper_SqlQueryBuilder:

$sqb = new Zend_Db_Mapper_SqlQueryBuilder($entityManager);
$sqb->fromEntity('Foo')
    ->where('some criteria')
    ->order('name')
$entities = $sqb->getResultList();

This code throws an exception saying that the column named 'name' does not exists, so I need to set the order to ...->order('nombre')..., so, the consumer code must know the entity metadata to write a query.

So, must the consumer code be aware of the entity metadata to be able to write queries?

--
Antonio Jose Garcia Lagar
http://aj.garcialagar.es
[email protected]

Reply via email to