Quick start guide #576
Replies: 2 comments
-
Currently, there is only "free" setup for Nette DI. We plan to support Symfony DI, PR is here. Similarly, you can implement something like that for ThePhpLeague container. There is also something like "simple" solution: SimpleModelFactory.php, its usage can be found in tests (This one is not using Dbal, but it may shed some light how to setup, your mappers will require the connection you are already able to construct). This may be a quick start for you before implementing the DI solution. |
Beta Was this translation helpful? Give feedback.
-
Thank you @hrach, I have been playing around and did get this working using my own DI. I will clean up what I've done and then reply here again some sample code so that others can see. |
Beta Was this translation helpful? Give feedback.
-
Hello, this ORM looks nice. So far I've been able to get the Dbal part set up and working. I've also used the Contributte ORM generator to reverse engineer my database into models/collections etc.
I've read the documentation for Orm. It seems to jump from a demonstration of how to do selects/inserts, but no actual setup guide? For example, how do I actually instantiate the 'Orm' class that extends Nextras\Orm\Model\Model? I would expect I need to pass in my database credentials or an instance of Nextras\Dbal\Connection.
I know there's an example using some Nette dependency injection. Is that mandatory? I'm currently using ThePhpLeague container for DI in my project.
Is this tightly coupled to Nette DI and whatever neon is and there's no way to use it by itself?
Beta Was this translation helpful? Give feedback.
All reactions