T
T
thatside2015-04-06 23:36:12
symfony
thatside, 2015-04-06 23:36:12

How to properly work with PHPExcel in Symfony2?

You need to convert a table in Excel to an HTML table (timetable at the university).
Two questions:
1. Are there any clear tutorials on phpexcel or bundles that use it (I use liuggio/ExcelBundle)?
2. How to correctly form an MVC structure with Excel? The selections from the file themselves must be in the repository, as I understand it? Or in a service? Then do we need any entities and how should they look like?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey, 2015-04-07
@thatside

Entities are your business objects. If we're talking about entities of course and not doctrine entities (those can be business objects, especially if you're using Doctrine 2.5, but it's still a little different).
A repository is the separation of the logic for storing data from its use.
The services remain. Ideally, you have a DTO that moves between PhpExcel and your code. This same DTO can only digest your application and service for working with PHPExcel.

R
Ruslan Kvashnin, 2015-04-06
@RussellKvashnin

For documentation , go here
. But in the second question, you can see a complete misunderstanding of the materiel, read more about MVC, about the organization of business logic.
Repositories and entities have nothing to do with it.

O
OnYourLips, 2015-04-07
@OnYourLips

2. How to correctly form an MVC structure with Excel?

The service is the most common, it sends data to the controller.
The controller simply calls the template engine with this data.
And the Excel document itself is already assembled in a template according to the data. Because the instructions for formatting an Excel document from data is a template.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question