Closed ManojBitx closed 6 years ago
When i adding the new data in Emails using "sonata_type_model" it gives an "500 Internal Server Error" but everything is working fine on app.php.
This means you are using app_dev.php
, right? If yes, why are you not providing a stack trace?
Hi @greg0ire
I am seeing the 500 Internal Server Error in Developer console. Its a ajax request. How i can get the stack trace for it.
Below are the logs of development env for this action.
I am seeing the 500 Internal Server Error in Developer console. Its a ajax request. How i can get the stack trace for it.
Open the symfony profiler, that will give you the profile for the current, non-ajax request. Then, on the left, you should see a form or links to other requests, I don't remember exactly how it looks like, but the thing is, you can find the profile for your AJAX request in there, and with it, the desired stack trace.
Hi @greg0ire I checked the all tabs in Profiler and didn't found any stack trace option for ajax request. Please check the below image of my profiler.
I can share the screen if you want. My Email address: smanojsaini@gmail.com
See the Last 10, Latest and Search
thingy top left? Find the profile of your AJAX request with it first, and worry about the stack trace later.
Here are the screenshot from Last 10.
This the screenshot of console.
This is the ajax call code written
But i don't see the failed request in Last 10 tab.
See that Status
field? Input 500 in it, you should get better results.
You can also input get-form-field
in the URL
filter.
If there is still no profile, it means symfony is not involved in answering this 500, which I doubt. In the second screenshot of the console, there is a "response" tab. Have you clicked it?
I searched using URL field and found the result in profiler. Below is the screenshot of that
I also checked the response tab that is showing blank. Also this thing i working fine on production the issue is only at development environment.
You found the correct profile! Great! You also found a preview of the exception, with a clear error message.
See that "Exception" menu entry? click it if you want something even more beautiful, but I think the solution is already clear: you must implement ListingPhone::__toString()
, or at least tell sonata which field to use to represent ListingPhone
, by using the property
option. Closing this this is not a bug.
@greg0ire The code to covert the Phone into string is already there in entity file.
Also, i checked the timestamp of the profiler. It is from 13:35 but the new profiler timestamps are 19:30. That one from 13:35 timestamp i was able to fine in profiler. The new requests are not logged in the profiler.
I don't how it is working fine on Production without changing anything.
Also the some deprecations showing. See below
Deprecation are something else completely. Make sure sonata is up to date before trying to fix them. For your issue, you can do step by step debugging with xdebug to find out what is going on. I suggest you clear your cache, try reproducing the issue in as few http requests as possible, and have a look at the profiler to see if the 500 still does not show up in it.
@greg0ire I tried everything that i can do. I tried clearing cache, checked all the logs, profilers but i didn't able to find why this is causing only on development environment. If you need any logs or any access from my side i will provide you.
I tried everything that i can do.
Really?
For your issue, you can do step by step debugging with xdebug to find out what is going on.
Did you even try this?
any news @cipherm ?
@OskarStark Still, this issue is pending
I just ran into this issue with Symfony 3.3 with the default configuration, the error came from the logger configuration (config_dev.yml):
server_log:
type: server_log
process_psr_3_messages: false
host: 127.0.0.1:9911
For me removing this section solved the problem.
Have You actually tried the solution given in exception message? Setting the "property" value for admin FormMapper?
->add('emails', 'sonata_type_model',array(
'multiple' => true,
'property' => 'phone'
))
Also try to provide some kind of default value for your field in __toString()
, like...
public function __toString() {
return $this->getPhone() ?? '9876543210';
}
Error is clear, toString method missing somehow. Closing. If this is relevant still with newer versions, please ping to reopen
Hello
I have two entities ["Listing", "Emails"] and created the One To Many association of Listing with Emails. I used the "sonata_type_model" on the Sonata Admin of Listing Entity.
When i adding the new data in Emails using "sonata_type_model" it gives an "500 Internal Server Error" but everything is working fine on app.php.
I tracked the some files of Sonata Admin and found the error is in below function.