Bug in PHP code generation

I noticed that if I create an entity with a composite key, the loadByORMID method that is automatically generated contains a bug:

   
public static function loadUserByORMID($name, $company) {
    $m = epManager :: instance();
    $user = $m->create('User');
    $user->name = $name;
    $users = $m->find($user);
    $userValues = array_values($users);
    return $userValues[0];
    $user->company = $company;
    $users = $m->find($user);
    $userValues = array_values($users);
    return $userValues[0];
  } 

As you can see the function signature correctly contains both pieces of the composite key. However, the code generator in DBVA is trying to perform two separate searches, one for each half of the key when in fact it should be searching for both halves at the same time as in the following example which I coded by hand:

   public static function loadUserByORMID($name, $company) {
    $m = epManager :: instance();
    $user = $m->create('User');
    $user->name = $name;
    $user->company = $company;
    $users = $m->find($user);
    $userValues = array_values($users);
    return $userValues[0];
  } 

Any idea how long this might take to fix?

Hello rbegga,

I’ll talk to our engineers and answer your qusetion asap.

Best regards,
Jick

Jick,

Thanks for looking into this I really appreciate it. Also, I am not sure if you saw my other post regarding transactions in PHP but I’m hoping maybe engineering has an idea there as well? I really need to be able to use transactions in my applicaitons.

-TJ

Hi rbegga,

This is a bug. We will fix it and send you a patch tomorrow.

Best regards,
Jick

Hello rbegga,

Sorry for my late reply. This is the download URL of the patch:
http://files3.visual-paradigm.com/200711/Patch/sp1_20071119j/VP_Suite_Windows_3_1_sp1_20071119j.exe

Please try it out.

Best regards,
Jick

Jick,

I need the patch to be for the MacOS X version of DBVA to test it out. Sorry I forgot to mention that again.

Thanks!

-TJ

Hello rbegga,

Please find the Mac version at
http://files3.visual-paradigm.com/200711/Patch/sp1_20071119k/VP_Suite_MacOSX_3_1_sp1_20071119k.dmg

Best regards,
Rain

That fix seems to have worked. Thanks!

-TJ