R
R
Rustam Idrisov2016-03-16 05:59:27
symfony
Rustam Idrisov, 2016-03-16 05:59:27

How to properly organize and create a project in Symfony 3?

Good day!
Within the framework of one charitable organization, I am developing a corporate network. And just recently, I discovered the existence of frameworks, which I was very happy about. Symfony 3 has been defined as the framework . Now I am actively studying it, but the fact is that due to the abundance of information on the official website (guidebooks) and “lessons” (sometimes miserable) from different videos / articles, I am afraid to form the wrong picture for myself. The main problem is that I can’t understand “the complete scheme / cycle of development and creation of a project on Symfony”. And I will be sincerely grateful if you can shed some light on my questions.
Essence:
There are 4 typical html pages (there are more of them in the project, but these are the main ones):

  • Login page (login.html)
  • Student Description Page (student.html)
  • Page with a list of all students (list.html)
  • Student news page (news.html)

These pages I plan to eventually convert to twig files for creating templates (with the exception of login.html, of course, since this page does not change the content).
Accordingly, the structure of the site is as follows: (1) Authorization (by any URL, whatever you enter) -> (2) If a student has entered, a news page for students opens; if a partner has entered, a list of all students opens -> (3) From the list of students, you can go to a specific student and view his profile.
I studied the types of tools (components) and features of Symfony, understood the hierarchy and purpose of all directories of a symfony project. Now I just can’t move on to writing code, because I don’t understand where to start and at what stages what tools to use.
Therefore, I will try to formulate in order the most specific tasks and questions that torment me:
  1. Where to start writing a project (what, in my case, should I do first)? (omitting the initial setup of the new project)
  2. Help , please, to draw up a detailed plan (scheme) for the development of the project (if possible, from “symfony new project”, to “upload to hosting”)
  3. Access to the corporate network should be closed to unauthorized users (for all unauthorized users - there should be a transition to login.page) - how / with what help to organize this?
  4. There should be 2 types of users - student, partner. After successful authorization in the system - if you are a student - go to news.html, if partner - then to list.html. At the same time, the partner user's access to the news.html page - should be closed, as well as list.html for the student - with what tools and how can I configure these things?
  5. Because there is a registration of students in the system, as well as data storage about them (from the name to the place of work / biography) - how and in what “place of the project” should I create and configure the database (s) in my case?
  6. How and in what form is it correct to create (and create for new users) permanent URLs for each user?
  7. (General) What are the best configuration options (files in app/config) that you would recommend for my case (or at this stage it is not so important)? I can not clearly understand which settings should be changed, and which ones it is undesirable to touch.
  8. Which Bundles should I take into account , which are the most popular in the community or which you use yourself.

For ANY of my questions, I will be very grateful for the answers: in the format of direct answers, videos, links to articles / necessary documentation, etc. - I will be grateful for everything that you can advise me to help.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Denis, 2016-03-16
@RustaMechanic

Throw out the third version and install 2.8
symfony.com/doc/current/book/installation.html
Connect the base
symfony.com/doc/current/reference/configuration/do...
Further, what I will write Sergey Protko will partially approve
Connect the FOSUserBundle and read the doc .
symfony.com/doc/current/bundles/FOSUserBundle/inde...
Adding 2 roles ROLE_STUDENT and ROLE_PARTNER
Hierarchy in security.yml

ROLE_STUDENT:
    ROLE_USER
ROLE_PARTNER:
    ROLE_USER

We create 2 more entities.
app/src/AppBundle/Entity/Student.php
app/src/AppBundle/Entity/News.php
and a couple of controllers.
DefaultController
StudentController
NewsController We protect
methods in NewsController with the role ROLE_STUDENT We protect
methods in StudentController with the role ROLE_PARTNER
symfony.com/doc/current/bundles/SensioFrameworkExt...
In the DefaultController which after authorization (target_path it seems) we hang redirects to controllers depending on the role.
Routing throughout the application will look something like this
/
/news
/news/{id}
/students
/students/{id}

Forget about
"These pages I plan to eventually convert to twig files for creating templates (except, of course, login.html, because this page does not change the content)."
All pages must be (preferably) on one of the templating engines.
By default twig
Forget about
"How and in what form it is correct to create (and create for new users) permanent URLs for each user?"
For sylla does not carry
"Access to a corporate network should..." - we call the familiar adin - it does not concern application in any way.
Stick to symfony.com/doc/current/best_practices/index.html
There are 3 controllers for such an application
(5 methods in total),
3 entities (2 repositories),
4 templates,
0 separate services and managers,
0 additional config files
0 listeners
0 own bicycles
several templates for FosUser (If you use it)
symfony.com/doc/current/cookbook/bundles/override.html

S
Sergey, 2016-03-16
Protko @Fesor

symfony.com/doc/current/best_practices/index.html

A
Andrey Kulikovsky, 2016-03-16
@by25

Where to start designing a project for Symfony2?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question