Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update installation documentation for Symfony Flex #1006

Merged
merged 1 commit into from
Jan 29, 2018

Conversation

kunicmarko20
Copy link
Contributor

@kunicmarko20 kunicmarko20 commented Jan 24, 2018

I am targeting this branch, because I am updating documentation for 4.x

Subject

I did a fresh install of SonataUser and docs weren't really ready for use with the new structure of Symfony Flex. Basically, with current documentation, someone that has never used Sonata packages would have a problem getting SonataUser working.

@kunicmarko20
Copy link
Contributor Author

There are some problems I encountered while installing and I need your suggestion on how to proceed and should this be added to docs:

1. When installing SonataAdmin there is an error:

The service "sonata.admin.block.admin_list" has a dependency on a non-existent service "templating".  

Solution is:

framework:
    templating:
        engines: ['twig']

As there are PRs on all bundles and Sonata is moving away from templating, I am not sure if this should be added?

2. When installing SonataUser there is an error:

friendsofsymfony/user-bundle v2.0.2 requires symfony/form ^2.7 || ^3.0

There still is no release of FOSUserBundle.

Solution:

composer require friendsofsymfony/user-bundle:2.1.x-dev

3. After installing FOSUser like I did in 2. because there is no recipe the bundle is added to bundles.php but cache clear after the installation throws an error because there is no configuration for FOSUser:

In ArrayNode.php line 238:
                                                                     
The child node "db_driver" at path "fos_user" must be configured.  

Solution:

Add configuration for FOSUser, I mean we know what to do and error is clear, but I am thinking about people that are installing this, this is connected to 2. with recipe in contrib repo this goes away.

4. The last error I encountered was this issue #942 (comment) and that comment is the solution by @jordisala1991

Did not get into details so not sure about that one at all I just added that config and it worked.

Next things are not issues but questions:

Do we still need the mention all the bundles in Enable the bundle part or just sonata-user?

php composer require sonata-project/user-bundle --no-update
php composer require sonata-project/doctrine-orm-admin-bundle  --no-update # optional
php composer require friendsofsymfony/rest-bundle  --no-update # optional when using api
php composer require nelmio/api-doc-bundle  --no-update # optional when using api
php composer require sonata-project/google-authenticator --no-update  # optional
php composer update

sonata-project/doctrine-orm-admin-bundle this one will probably already be installed as you have to follow sonata admin installation first.

Should I add Sonata block configuration to part 2.3 and move

sonata_block:
    blocks:
        #...
        sonata.user.block.menu:    # used to display the menu in profile pages
        sonata.user.block.account: # used to display menu option (login option)
        sonata.block.service.text: # used to if you plan to use Sonata user routes

from the ACL configuration to that new part?

This is it, for now, will wait for your feedback and hopefully this gets merged soon so people can install it without problems.

@greg0ire greg0ire added the docs label Jan 24, 2018
@greg0ire
Copy link
Contributor

@covex-nn please answer 1.


ACL Configuration
~~~~~~~~~~~~~~~~~
When using ACL, the ``UserBundle`` can prevent `normal` user to change
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

users

ACL Configuration
~~~~~~~~~~~~~~~~~
When using ACL, the ``UserBundle`` can prevent `normal` user to change
settings of `super-admin` users, to enable this add to the configuration:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"use the following configuration"

Copy link
Contributor

@greg0ire greg0ire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job!

php composer.phar require nelmio/api-doc-bundle --no-update # optional when using api
php composer.phar require sonata-project/google-authenticator --no-update # optional
php composer.phar update
php composer require sonata-project/user-bundle --no-update
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could remove php as well

@covex-nn
Copy link
Contributor

covex-nn commented Jan 25, 2018

The service "sonata.admin.block.admin_list" has a dependency on a non-existent service "templating".

@kunicmarko20 this error will go away if sonata-project/SonataDoctrineORMAdminBundle#794, sonata-project/SonataAdminBundle#4897 and #1000 will be released (newest BlockBundle already does not use templating service). Then a recipe for sonata-project/admin-bundle must be created and aproved. See symfony/recipes-contrib#264 (it is almost ready).

With a recipe AdminBundle could be installed and configured by this commands:

composer create-project symfony/skeleton .
composer config extra.symfony.allow-contrib true
composer require sonata-project/doctrine-orm-admin-bundle

Also, for sonata-project/doctrine-phpcr-admin-bundle sonata-project/SonataDoctrinePhpcrAdminBundle#517 must be released.

@covex-nn
Copy link
Contributor

Also with FriendsOfSymfony/FOSUserBundle#2708 and FriendsOfSymfony/FOSUserBundle#2707 it will be possible to create a recipe for FOSUserBundle

@kunicmarko20
Copy link
Contributor Author

Thank you for info @covex-nn. So I won't add 1., 2. and 3. to docs. The only issue that is left is number 4. and my question about Enable the bundle part and sonata block config.

@covex-nn
Copy link
Contributor

covex-nn commented Jan 25, 2018

@kunicmarko20 i'm waiting for a PRs reviews in FOSUserBundle already 15 days =) and may be we will wait a month (or even more) for a 2.1.0 release. So, may be a few words about FOSUserBundle configuration would be fine.

Anyway here is how FOSUserBundle could be configured in the future with Flex FriendsOfSymfony/FOSUserBundle#2704 (comment). The main part is:

fos_user:
    service:
        mailer: fos_user.mailer.twig_swift

This parameter will not require templating service.

@@ -7,7 +7,8 @@ Installation
Prerequisites
-------------

PHP 7 and Symfony 2.8 or 3 are needed to make this bundle work; there are also some Sonata dependencies that need to be installed and configured beforehand:
PHP 7 and Symfony 2.8 or 3 are needed to make this bundle work, there are
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

7.1. Symfony 2.8, >=3.2 or 4 right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3.2 support is ending next week, should I mark it as 3.3 instead?


Next, be sure to enable the bundles in your and ``AppKernel.php`` file:
Next, be sure to enable the bundles in your ``bundles.php`` file if they
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we explain for sf 3 and sf 4?

on Sf 2/3 it should be AppKernel

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As flex is now the default way of creating new projects I though that should only be documented or am I wrong? @greg0ire I remember we talked about this on slack WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We MUST assume everyone is using sf 4 and flex. We CAN add sf 2/3 instructions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That means I would need to add a note or something like but if you are using symfony 3, do it this way? so SHOULD I?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's really up to you. Personally, I think people that don't know how to register a bundle and also don't start with sf 4 might be quite rare, so it's probably not needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with that because current Symfony doc points to 4.0 and if you are using 3.4 you probably went with flex, if not then you know what you are doing. I do not mind adding docs for 3. If rest of the people think it should be added.

@kunicmarko20
Copy link
Contributor Author

I added docs for non-flex but I do not really like all the notes with If you are not using Symfony Flex, what do you think?

Sonata\CoreBundle\SonataCoreBundle::class => ['all' => true],
Sonata\BlockBundle\SonataBlockBundle::class => ['all' => true],
Sonata\EasyExtendsBundle\SonataEasyExtendsBundle::class => ['all' => true],
FOS\UserBundle\FOSUserBundl::class => ['all' => true],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bundle


If you specify no parameter, the files are generated in ``app/Application/SonataUserBundle`` but you can specify the path with ``--dest=src``
With provided parameters, the files are generated in ``src/Application/SonataUserBundle``.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wrong, it should be src/Application/Sonata/UserBundle

new Sonata\UserBundle\SonataUserBundle(),
// ...
);
return array(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you add an extra space?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't see it, will be fixed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and you can use short array syntax here, too

#...
sonata.user.block.menu: # used to display the menu in profile pages
sonata.user.block.account: # used to display menu option (login option)
sonata.block.service.text: # used to if you plan to use Sonata user routes
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the comment looks strange

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, that block is not connected to user bundle at all, also all the other blocks are removed in 4.x (not sure if intentionally /cc @jordisala1991 ), I think I will just remove this section.

@greg0ire greg0ire merged commit f9a56fe into sonata-project:4.x Jan 29, 2018
@greg0ire
Copy link
Contributor

Thanks @kunicmarko20 !

@kunicmarko20 kunicmarko20 deleted the update_docs_for_flex branch January 29, 2018 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants