sonataadmin as both frontend and backend for symfony 2 project - symfony

I used sonataadmin and really like some features, like creating an entity and its related entity in the same page. I want to use it for frontend user also. Is it possable to use sonamaadmin for both backend and frontend users? Or is there another bundle allowing me to create an entity and its related entity in the same page?

Those are just form types, provided by the SonataAdminBundle. You can use them in any form.
You probably looking for the sonata_type_model or sonata_type_collection. See the documentation for more information.

Of course you can use Sonata Admin in both, although will be like only having a backend and made the correct security configuration for two kind of users. About entity and its related entities in the same page, that has nothing to do with Sonata, this can be achieved with symfony simple and embed forms.

Related

EasyAdminBundle + FOSUserBundle user management

I am doing a back office under symfony and easy admin bundle and FOSUserBundle. I would like to know if it was possible when the admin connects in his space, he sees only the normal users, which do not have the role admin only.
or separate administrators from normal users.
I ask the question because using Sonata I know it's possible, but since I have to do it under easyadmin I do not know if it's feasible.
I have been trying to do this for a while now and I would like to know if it was possible.
Merci d'avance :)
In easy admin bundle you can filter entities with a DQL FILTER see the documentation here
You can use this for dislplaying only normal users.
you can try this filter:
dql_filter: "entity.roles NOT LIKE '%%env(ROLE_ADMIN)%%'"
as you seem to be French-speaking, here is a very interesting article about easyadminbundle

Sulu cms: Create bundle for custom controller

I am using sulu minimal edition.
So i want to create bundle for my custom controllers.
I have contact form in my website.
On form submit i want redirect to symfony route.
Save data in custom table and display in admin area user role wise. Whats best way?
I follow http://blog.sulu.io/how-to-develop-a-bundle-in-the-sulu-admin-1
but php on ./bin/websiteconsole debug:router my new routes created in controller not showing.
Sounds like you use annotations. Dit you try defining your route with XML?
As far as I know annotation - and XML defined routes can't be mixed within the same bundle (some please correct me if I'm wrong). Since Sulu uses XML I'd stick to that for the sake of consistency.

Sonata User Bundle + FOS User bundle + Custom user bundle

i'm little confused..
I'm using sonata admin bundle in my project and i'd like to install user management for this, tell me please do i really have to install sonata user bundle? (i was using this tutorial http://domitable.com/content/getting-started-symfony-23-sonata-admin-user-bundles ) or only fos user bundle will be enought? i'm asking this becouse i want to install as little dependiendes as possible.
honestly the best way for me would be to use only my custom user bundle with custom user entity..(if need be only my class + FOS)
Do i have to use easy-extends to generate my user entity class or default doctrine generate entity is okay?
What about sonata ACL in this sitaution?
what is the best way to resolve this issue?
I'll try my best with what I have. Basically, SonataUserBundle is only useful if you want to manage the users via SonataAdmin.
FosUserBundle is simply a bundle that manages users and some actions such as login, but from the point of view of a user. That is, it does not have the tools built in for an admin to manage users.
Therefore, to manage the users, you need SonataAdmin and SonataUser.
If you easy extends SonataUser, then you could transfer your custom entity in the extended bundle. That is a way you could do it.
ACL is a complete different thing, read here for more information:http://symfony.com/fr/doc/current/cookbook/security/acl.html

Easiest way to integrate captcha's into Symfony2 FOSUserBundle registration?

I'm using Symfony2 and the FOSUserBundle to manage registration and logins. I'd like to add a captcha system. Is there are pre-existing bundle or tutorial on this?
Of course, I could try to roll my own using Google re-captcha. In that case, is Google reCaptcha a good choice, or should I use some other API?
There are indeed a bundles for that, take a look at:
CaptchaBundle
Or
EWZRecaptchaBundle
Both got (most likely) all the documentation you need added in the README.md file or extended documentation.
I just wrote a tiny bundle called caitcha-bundle.
According to this part of the fos user bundle documenation implementation should be quite easy because you only have to activate the caitcha bundle and add $builder->add('caitcha', 'caitcha'); to the form type.
Because captcha images and any other approaches that require some user interaction which is not related to the form itself are very annoying in my optinion, I tried to implement an invisible bot protection by using the honeypot method and a check for the time it took to fill in the form. It works well for my use cases but still has to be extended by more checks I suppose. I would appreciate any suggestions to improve this bundle.

Where to place entities that are global to an app?

I'm working on a large Symfony2 app that has the following bundles (all under the same vendor name): Login, Register, Blog, Forum. The official docs say that forum related entities belong in the Forum bundle, and Blog related entities belong in the Blog bundle. But what about my User and Account entities? Both are created during the registration process, and User is used during the login process. I consider those entities to be global to the app b/c their use isn't limited to one feature (again, per Symfony docs, one 'feature' per bundle.) I'm wondering what the best practice for this would be.
You can create UsersBundle and in future store other code, related to users in this bundle.

Resources