Closed NadaBen closed 8 years ago
Hello,
Have you create an elastica block in your config.yml ? You have an example in our demo project demo project. The error is surely caught when the composer rebuild the application cache. And Nemrod read the config.yml file during the cache compilation.
If you does not want to work with elasticsearch, you can also remove the ElasticaBundle from the AppKernel.
I hope it will solve your problem. If not, do not hesitate to ask us some help again ;-)
solved when i removed elasticsearch,, but if i use elasticsearch with the demo project it gives me this error
Twig_Error_Loader in unable to find frame
have you any idea about that ?
Nemrod use JsonLD frames to serialize RDF resources. So, it is used for elasticsearch serialization.
If we read the config.yml file in the demo project, we can see a frame: "@Demo/Laureate/laureate.jsonld"
A such path will search a frame in DemoBundle/Resources/frames/Laureate/laureate.jsonld. Maybe this frame does not exist in your project ?
i did that , same error
Did you try a cache:clear ?
when i clear my cache it gives me
[Twig_Error_Loader] Unable to find frame "@Photos/PhotoResource/PhotoResource.jsonld".
this is my class resource `<?php
namespace TestTask\PhotosBundle\RdfResource;
use Conjecto\Nemrod\Resource as BaseResource; use Conjecto\Nemrod\ResourceManager\Annotation\Resource; use Conjecto\Nemrod\ResourceManager\Annotation\Property; use Conjecto\Nemrod\Framing\Annotation as Serializer;
/**
the file PhotoResource.jsonld is in TestTask\PhotosBundle\Resources\PhotoResource
and my configuration is as follows : `elastica: clients: default: host: %elasticsearch_host% port: %elasticsearch_port%
indexes: PhotoResource: client: default settings: index: analysis: analyzer: en: tokenizer: standard types: PhotoResource: type: "terms:PhotoResource" frame: "@Photos/PhotoResource/PhotoResource.jsonld"`
If you remove the line @Serializer\JsonLd(frame="@Photos/PhotoResource/PhotoResource.jsonld"), does the problem persist ?
yes the same error
is he has a relationship with the twig files ??
No but we use the twig file finder to get frame files
yes so do you have any other idea ?
Yes there is a problem with the frame path. I'm searching the corresponding code in Nemrod to guide you find the searched path.
Ok i'm waiting for your response, thank you
You can go to Twig_LoaderFilesystem file at line 200 and dump all $path.'/'.$shortname_ searched. You should see you JsonLD frame with expanded searched path.
in this code ` foreach ($this->paths[$namespace] as $path) { if (is_file($path.'/'.$shortname)) { if (false !== $realpath = realpath($path.'/'.$shortname)) { return $this->cache[$name] = $realpath; }
return $this->cache[$name] = $path.'/'.$shortname;
}
}`
i must do what, i dont understand
add var_dump($path.'/'.$shortname); before if (is_file...) to see all searched pathes. You should see your jsonld frame pathes
and verify if there are correct
i did that ` foreach ($this->paths[$namespace] as $path) { var_dump($path.'/'.$shortname); if (is_file($path.'/'.$shortname)) { if (false !== $realpath = realpath($path.'/'.$shortname)) { return $this->cache[$name] = $realpath; }
return $this->cache[$name] = $path.'/'.$shortname;
}
}`
and i clear cache but still the same error
Yes but it should display your entire jsonld file path. Is it displayed and is it correct ?
ah it's not displayed
Go to Conjecto\Nemrod\Framing\Loader\JsonLdFrameLoader at line 130 in getSource function add a var_dump($name); before return line to see if it enters in function
in JsonLdFrameLoader , i dont have getSource , i have it in function getFrame in line 56 as follows:
` /* * Return the decoded frame. / public function getFrame($name, $assoc = true) { $decoded = json_decode($this->getSource($name), $assoc); if ($decoded === null) { throw new \Twig_Error_Loader(sprintf('Unable to decode frame "%s".', $name)); }
return $decoded;
}`
My fault, this function is in FileSystem class. If you do the var_dump at line 56 before the getSource, does it display something during cache:clear ?
yes it shows me that: string(42) "@Photos/PhotoResource/PhotoResource.jsonld"
and the same error
So it should enter in FileSystem::findTemplate method. Can you display several var_dump to identify when the function is returned
when i display var_dump in FileSystem::findTemplate method. it gives me string(42) "@Photos/PhotoResource/PhotoResource.jsonld" too
Yes but can you make a var_dump before all returns to see which return is called
this one before return $this->cache[$name] = $path.'/'.$shortname; which is returned
And what is displayed if you do a var_dump($path.'/'.$shortname) just before this return ?
i'm sorry it was a mistake, it is not displayed with any returned in FileSystem::findTemplate method
Ok... can you follow the Conjecto\Nemrod\Framing\Loader\JsonLdFrameLoader::getFrame process and with var_dump see where it goes ? I have no other ideas
null, when i try to display that too $decoded = json_decode($this->getSource($name), $assoc); it gives me null
because getSource gives null , so problem is in findTemplate method
in findTemplate methods, where is it return ? Have you register your new bundle in the AppKernel ?
yes all bundles are registred
new Conjecto\Nemrod\Bundle\NemrodBundle\NemrodBundle(),
new Conjecto\Nemrod\Bundle\ElasticaBundle\ElasticaBundle(),
new TestTask\PhotosBundle\TestTaskPhotosBundle(),
it is not displayed with any returned in FileSystem::findTemplate method
if i use nemrod witout elastica, can i display, use sparql and create rdf resources and entities, because i want to connect the application with virtuoso ?
Try to replace "Photos" in your frame path by "TestTaskPhotos".
Yes you can create, edit and delete RDF resources, especially with forms.
when i try it with TestTaskPhotos, it shows me this error
[Twig_Error_Loader]
Unable to decode frame "@TestTaskPhotos/PhotoResource/PhotoResource.jsonld"
.
Can you go in vendor/twig/twig/CHANGELOG and see which version it is at top of the file please ?
ok I have the same version.
Can you go on addPath method in filesystem class and add var_dump($path); var_dump($namespace); and see if it display something
It gives me string(59) "C:\wamp\www\test\src\TestTask\PhotosBundle/Resources/frames" string(14) "TestTaskPhotos"
and the error
[Twig_Error_Loader]
Unable to decode frame "@TestTaskPhotos/PhotoResource/PhotoResource.jsonld"
.
Ok so you have to use a @TestTaskPhotos / instead of @ Photos with your frame.
You should have your file at path C:\wamp\www\test\src\TestTask\PhotosBundle\Resources\frames\PhotoResource\PhotoResource.jsonld . Is it the case ? Just to be sure.
exactly i must to have this path, i'm using @TestTaskPhotos
Can you send me your zipped bundle at my email address please ?
Done
You have to remove the last coma of your frame after dc:type: {}
Does it work ? Your frame was not correct
it works now. thank youu a lot
Hello, please i need some help, when i update my composer and i try to clear the catch it gives me this error : 1/ ContextErrorException in ElasticaFramingRegistrationPass.php line 28: Notice: Undefined index: indexes,
2/at ErrorHandler->handleError('8', 'Undefined index: indexes', 'C:\wamp\www\test\vendor\conjecto\nemrod\src\Conjecto\Nemrod\Bundle\ElasticaBundle\DependencyInjection\CompilerPass\ElasticaFramingRegistrationPass.php', '28', array('container' => object(ContainerBuilder), 'config' => array(), 'jsonLdFrameLoader' => object(JsonLdFrameLoader))) in ElasticaFramingRegistrationPass.php line 28
line 28 of ElasticaFramingRegistrationPass.php is as follows:
foreach ($config['indexes'] as $name => $types) {
how to solve that please ?