Open ktom opened 3 years ago
For nelmio alice there is a native loader which should help out. For this library part though there's not been a need for it yet so you would indeed need to create everything yourself by hand or alternatively register the appropriate services to your container
Thanks for the feedback,
I've been checking the native loader and indeed it's a great way to have a pre-configured loader but it's not easy to customize except by extending it.
I've finished recreating the object graph it's more or less 250 lines of code ^^
Would you consider a PR on alice introducing a builder for the loaders, something like:
class LoaderBuilderTest extends TestCase
{
public function test_it_creates_a_prefconfigured_files_loader()
{
$loader = LoaderBuilder::simpleFilesLoader()
->getLoader();
$this->assertInstanceOf(SimpleFilesLoader::class, $loader);
}
public function test_it_can_change_property_accessor()
{
$loader = LoaderBuilder::simpleFilesLoader()
->withPropertyAccessory(new MyProperyAccessor())
->getLoader();
$this->assertInstanceOf(/** */);
}
}
I don't know what king of meaningfull tests could be done here as the goal of the builder is to set the internals of the class ... I'm also open to other suggestions that could help me use the lib outside of symfony
@ktom would it be possible to have more details on what the graph looks like? I don't think you should have much from NelmioAlice as there is a NativeLoader
or something equivalent to help out with it.
But otherwise I think it's a tedious task as it would require a native loader for different bridges (ORM, ODM, PHPCR, Eloquent...)
Hello,
I've been trying to use the lib outside of a symfony project, in a package using doctrine.
Following the basic exemple from the doc i've been trying to do something like
I gave up on the huge object graph part :'(
Do you have any exemple of how to use the lib outside of SF or any advice on how I could achieve this ? Thank you in advance