@@ -184,3 +184,47 @@ You can add your own methods to entities and change getter/setter functions, the
184184## Configuration
185185
186186see src/Generator/Config.php
187+
188+ # Docker integration
189+
190+ ## Entity Generator image
191+
192+ ![ Docker Pulls] ( https://img.shields.io/docker/pulls/pifou25/entity-generator )
193+ https://hub.docker.com/r/pifou25/entity-generator
194+
195+ ## Generation from existing database
196+ The database should be accessible from the docker network, the hostname is either
197+ the name of the Mysql running container, or ` localhost ` if db is running on host.
198+ The below command will generate entities into ` ./entities ` directory.
199+
200+ ```
201+ docker run --rm -v $PWD/entities:/app/entities --network some-network \
202+ -e MYSQL_HOSTNAME=some-mariadb \
203+ -e MYSQL_DATABASE=exmple-database \
204+ -e MYSQL_USERNAME=example-user \
205+ -e MYSQL_PASSWORD=my_cool_secret \
206+ pifou25/entity-generator
207+ ```
208+
209+ ## namespace and extends example
210+ The base class must exist into /entities to be declared
211+ ```
212+ docker run --rm -v $PWD/include/entities:/app/entities --network scripts_default \
213+ -e MYSQL_HOSTNAME=myhost \
214+ -e MYSQL_DATABASE=mydb \
215+ -e MYSQL_USERNAME=myuser \
216+ -e MYSQL_PASSWORD=mypwd \
217+ -e ENTITY_NAMESPACE=Example\\Pdo\\Entities \
218+ -e BASECLASS=Example\\Pdo\\Entities\Entity \
219+ entity-generator
220+ ```
221+
222+ ## Generation from flat plain SQL file
223+
224+ The ` docker compose ` file create a new database and initialize it with SQL data,
225+ you have to put SQL init file into ` ./examples ` directory. When db is ready,
226+ the entity-generator start on it to generate PHP entities.
227+
228+ It is as simple as running this command from the ` docker ` directory :
229+ ` docker compose up `
230+
0 commit comments