Generated server code for PHP doesn't work

Dear Backendless,

I don’t know if it’s me but the code generated for PHP just doesn’t work. I had to debug CodeRunner just to get something running but there are too many things for me to even debug my own code.
For a start, PHP classes are generated with the wrong capitalisation. For instance, I have a table named ‘latest_post’ but the PHP class is called ‘Latest_post’, with a capital L. So I had to go and fix the code in ClassManager in order to be able to load the classes at runtime. Ok, this works. But then when I create a new entity and try to save it It get an error like so:

[ERROR] In Backendless SDK occurred error with message: "Backendless API return error: Wrong entity name character case for: Latest_post. Use existing table latest_post. Error code:2024"

So I went and changed the name of the classes in the generated code, as well as the name used as a parameter like so:

class Latest_post
=>
class latest_post

And:

        return Backendless::$Data->of( 'Latest_post' )->save( $this )->getAsClass();
=>
        return Backendless::$Data->of( 'latest_post' )->save( $this )->getAsClass();

After successfully saved a new object, I get the following error:

Fatal error: Call to undefined method com\backendless\blogme\models\latest_post::getAsClass() in /Volumes/Data/iPhone/Backendless/BlogMe/ServerCode/classes/com/backendless/blogme/models/Latest_post.php on line 95

Can you please indicate me a fix quickly so that I can get it to work? Is it OK to get rid of that getAsClass() call?

Thanks!

Hi Emmanuel,

It is definitely not you… The PHP code (SDK and CodeRunner) is being actively worked on and feedback like this is extremely important to us. We will look into it right away.

If you are familiar with Java, I would recommend using the Java-based business logic as it has reached the production stage (the PHP code is not quite there yet).

Regards,
Mark

Hi Mark,

Unfortunately I don’t speak Java :slight_smile:
Ok, I didn’t know that you are still working on the PHP code. I’ll share my findings with you, where is the best place to do that?

You can post either here to the forum or send them directly to me: mark@backendless.com

Really appreciate your help!! Thank you.

Hello, Emmanuel!

The issue has been fixed on production, so can you please try again?
best regards,
Alex