New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JMSSerializerBundle configuration Metadata (2) #650
Comments
From what I remember, the third parameter in the view method are the http headers, not the groups. Groups have to be set later on the view object |
@goetas thank you for your response, good point. we use a wrapper method in ApiController. the method builds a view (just like you've described) then creates a context adds groups and setContext of the view.
as you can see, groups are there. |
Pay attention that if the prefix namespace us app\entity, the metadata file should be just named sing.yml not entity.song.yml |
Do not forget to clear the cachr |
@goetas okay. |
Do you know mind checking if this https://github.com/schmittjoh/metadata/blob/4f1cd28ff9cc156d06bd25df401369a3d64150f3/src/Metadata/Driver/AbstractFileDriver.php#L24 line of code is ever reached? And ckeck the value of the $path variable (is the file that jms will try to load for the metadata extraction) |
@goetas, the $path is null and the $class is Doctrine\Common\Collections\ArrayCollection.
|
So, retrieveSongs is returning an arraycollection, have you tried converting it to an array? |
@goetas here what I get when I convert the result to an array:
the Song entity is indeed located in src/Entity/Song/ directory. |
Ok.means the file is not found. You can debug this method https://github.com/schmittjoh/metadata/blob/4f1cd28ff9cc156d06bd25df401369a3d64150f3/src/Metadata/Driver/FileLocator.php#L25 to check all the paths the serializer is trying |
@goetas okay, and here's what I have got from $path = $dir.'/'.str_replace('\', '.', substr($class->name, $len)).'.'.$extension:
|
Something is wrong, "%kernel.root_dir% should be an absolute path, not relative |
yes it is. sorry, I removed some parts, here what it looks like:
|
@goetas I found what causes the issue! |
Ah, ok. so, your entity is called |
yes, correct. thanks a lot for your help! |
I got the same issue, i tried all the possible solutions but not works. Please help! |
@goetas Got same issue, the line of code is not reached for me . Please help |
As you can read here, each issue was related to typos in path names or classes, so please carefully check the various paths and namespaces |
@goetas I got Found unknown escape character "\C" at line 190 (near "namespace_prefix: error but if i give without double quotes no error shown. Please assist |
Just use single quotes
…On Mon, 21 Jan 2019, 07:54 smuralidharan ***@***.*** wrote:
@goetas <https://github.com/goetas>
Yes i thought the same, inside app/config/config.yml we have this code
under jms_serializer:
namespace_prefix: "Just\Captive\CoreBundle\Entity\User"
I got Found unknown escape character "\C" at line 190 (near
"namespace_prefix: error
but if i give without double quotes no error shown. Please assist
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#650 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAvaJxtaTmfUELrpm1ERJfno1vEhYxEMks5vFWQ8gaJpZM4TXAiY>
.
|
Now i don't get any error but the line of code below is still not reached . Any other way to debug this issue?
|
I struggled with XML metadata too until I realized I was making the same mistake as mentioned by @mehdi-zarrin : $serializer = $this->get('jms_serializer'); Maybe this helps! |
hello. first of all: thanks a lot for this wonderful bundle. it's very useful.
I have an issue with jms/serializer-bundle: 2.3.1 and symfony 4.0.6. When react app retrieves the data, it receives empty objects:
Here's the content of jms_serializer.yaml
Here is my song entity serialization config (src/Resources/config/serializer/Entity.Song.yml)
Controller
I have no idea why it doesn't work. It worked fine with model annotations but completely broken now, with yml configs. Need some help :) Thanks in advance.
ps: bundle is enabled (bundles.php);
all steps, described in #536 are done and checked without any success
The text was updated successfully, but these errors were encountered: