0

When we generate a service, it usually create a file only contain all of class as if, client, processor,... such as:

//Calculator.thrift
namespace php Test;

service Calculator {

   i32 add(1:i32 num1, 2:i32 num2),

}

And it will generate a file:

//Calculator.php
namespace Test;

interface CalculatorIf {
  public function add($num1, $num2);
}

class CalculatorClient implements \Test\CalculatorIf {
   //code...
}

//other class ...

But in my case, i use Autoloading Class feature of PHP 5 (spl_autoload_register()), my framework base on name of class to (auto) include class file. So that (and problem), it don't know where it can load class file because name of class is not the same as name of file. So, I want to generate multi files with each class (be declared) in a file.

Deka
  • 1,333
  • 12
  • 14
  • I'm not a PHP guy, but have you tried all the options? Otherwise, if such a feature makes sense but does not exist yet, [we are open to contributions](http://thrift.apache.org/docs/HowToContribute). – JensG Nov 04 '14 at 08:56
  • With PHP, Thrift also have ThriftAutoLoader class with registerDefinition() function for autoloading-class from single file that is generated by Thrift. But, don't want to have an exception for each service (use registerDefinition() to specify it), i want that every class will be auto-loaded by my method only. – Deka Nov 04 '14 at 09:24
  • Maybe the mailing list (or the freenode channel) is a better place to discuss this. As I said, I'm not really into that PHP stuff because I don't use it myself. – JensG Nov 04 '14 at 09:34

0 Answers0