Posts Tagged php

“Order By” for Zend Db findDependentRowset()

This is another one of those note-to-self style posts.

Design decisions on Zend Db’s “Zend_Db_Table_Row_Abstract” class prevent the inclusion of an ‘order by’ clause directly in the (incredibly useful) “findDependentRowset” function.

But you can pass in the order by clause indirectly through a select statement as follows.

What you want would be something like:

$depRows = $row->findDependentRowset('DEP_TABLE_NAME', /*order by=*/'SORT_ORDER ASC');

and you get this by doing the following:

$depTable = new DEP_TABLE_NAME();
$depRows = $row->findDependentRowset($depTable, null, $depTable->select()->order('SORT_ORDER ASC'));

,

1 Comment

Calling SAP from PHP (on OS X)

You’d think it’d be easy eh?

  • My first google turned up SAPRFC, an extension module for php which allows direct ABAP calls from php.  ‘Perfect’, I thought, until I discovered that it is now essentially unmaintained, and it seems that no one ever tried it on OS X in the first place.
  • Very very happy was I then when I discovered its (very new) successor: sapnwrfc.  But no one has bothered to compile this yet on OS X either (and, like its predecessor, it requires the SAP RFC SDK, which I don’t have).  And besides, it really is very new, just a month or so old – not suitable for production then.
  • So I resigned myself to using another language to bridge the gap.  My first thought (my first hope really), was perl.  This turned up SAP::Rfc, written by the same guy who’s creating sapnwrfc.  But this also requires the SAP RFC SDK, and I couldn’t find anyone who’d ever compiled this on OS X.
  • So why not Java?  The SAP client my employer would have me use is pure Java, so surely I could use the same technologies?
    And this is where I stand at the moment: Use PHP/Java Bridge to call from php to Java, and SAP JCo to call from Java direct to SAP.

Yes, it’s cludgy, horrible, and sounds stupid.  And it probably is stupid.  But it’s how I plan to proceed for the present.  Tomcat will host the Java VM, and – if all the PHP/Java Bridge documentation is to be believed – there will be no need for Java ‘glue’ code, I should be able to use the JCo code directly in php.

If I live through the experience I’ll post more info about this soon.

Some pre-emptive defence: I know there are other technologies which would be preferable to my current solution – but I can make no changes whatsoever to SAP, this severely restricts my options.

, ,

2 Comments

css.php