DBVA, PHP Code generation and EZOQL queries

Hello,

Today I tried a simple case to test php code generation with DBVA but I had a problem with EZOQL queries. Let us considering the attached class diagram.
So we have a “Product” which can be associated to a “Category”

I have no problem when I generate php code and when I use the sample files.
Now, I tried to write a EZOQL query in order to retrieve products associated to a specified category. So this is something like this :

 
    $m = epManager :: instance();
    $sql="From Product as p where p.category.iD=1";
    $products = $m->query($sql);
  

But it returns the following error :

Fatal error: Uncaught exception ‘epExceptionDbAdodb’ with message 'Cannot execute query: mysql error: [1146: Table ‘test._ezpdo_relation_category_product’ doesn’t exist] in EXECUTE(“SELECT DISTINCT p.* FROM Product AS p LEFT JOIN _ezpdo_relation_category_product AS _1 ON _1.var_a = ‘category’ AND (_1.class_a = ‘Product’ AND _1.oid_a = p.eoid) LEFT JOIN Category AS _2 ON _1.base_b = ‘Category’ AND _1.class_b = ‘Category’ AND _1.oid_b = _2.eoid WHERE _2.ID=1”) ’ in D:\xampp\htdocs\test\lib\phporm\src\db\epDbAdodb.php:188 Stack trace: #0 D:\xampp\htdocs\test\lib\phporm\src\db\epDb.php(352): epDbAdodb->_execute(‘SELECT DISTINCT…’) #1 D:\xampp\htdocs\test\lib\phporm\src\db\epDbObject.php(3526): epDb->execute(‘SELECT DISTINCT…’) #2 D:\xampp\htdocs\test\lib\phporm\src\db\epDbObject.php(2129): epDbObject->_execute(‘SELECT DISTINCT…’) #3 D:\xampp\htdocs\test\lib\phporm\src\db\epDbObject.php(2106): epDbObject->_queryObjects(Array, Array, Array, false) #4 D:\xampp\htdocs\test\lib\phporm\src\runtime\epManager.php(610): epDbObje in D:\xampp\htdocs\test\lib\phporm\src\db\epDbAdodb.php on line 188

Indeed the table ‘_ezpdo_relation_category_product’ doesn’t exist in the database. I looked at the source code and I noticed that you have commentted some lines (particularly in epDbObject.php) in order not to use a relation table.
So I would like to know if there is a bug or if I forgot something which makes it not functionning. Or maybe there is another way to write my query??

Thanks

testCase.jpg

Hi user,

We are reviewing your post. Will come back to you as soon as possible.

Best regards,
Jick

ok thanks

any news about my problem?

Hello whiterabbit19,

Sorry for not having replied. We are still discussing this issue. I’ll let you know our decision as soon as I can.

Best regards,
Jick

Hello whiterabbit19,

Sorry for my late reply. This problem has been fixed. Please download and install the patch at:
http://files3.visual-paradigm.com/200711/Patch/sp1_20071116a/VP_Suite_Windows_3_1_sp1_20071116a.exe

Best regards,
Jick

Hi whiterabbit19,

Have you tried with the patch? Does it helps?

Best regards,
Jick