L
L
LobsterJoe2018-11-22 23:03:38
symfony
LobsterJoe, 2018-11-22 23:03:38

How to use an external API as a data source for an entity?

Situation: there is an external read-only API, at the moment the application interacts with it using EightPointsGuzzleBundle. I would like to work with this data as with Doctrine entities.
Do I understand correctly that for this I need to create a repository in which to implement the methods find (), find All (), etc., using the API to receive data and already in these methods to deserialize?
Show me the right direction.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
LobsterJoe, 2018-11-28
@LobsterJoe

At the moment, I did the following - put the console command in Cron and pour json into entities with Batch Processing. At the moment, it took 70 seconds to update 7k records.
I didn’t bother with many things, I stuffed everything that didn’t fit into regular fields into @ORM\Column(type="json_document", nullable=true, options={"jsonb": true}) (used dunglas/doctrine-json-odm ).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question