Migration from Propel to Propel2 - symfony

I want to migrate a Symfony2 project (v.2.7.1) from Propel1.7 to Propel2 (currently "alpha 5").
I'm using various Propel behaviors and third party bundles which relies on "Propel" adaptators to correctly work. It will be very helpful for me to have your comments for each behavior / bundle to know if it's trivial to migrate or if difficulties (and which!) could happen...
Behaviors:
Archivable
NestedSet
Sluggable
QueryCache
Timestampable
Typehintable (willdurand/propel-typehintable-behavior)
Equalnest (craftyshadow/propel-equalnest-behavior)
Geocodable (willdurand/geocoder-bundle)
Third party bundles:
FOSUserBundle
GlorpenPropelBundle
FOSElasticaBundle

Core behaviors
Theses behaviors are still in Propel2
Archivable
NestedSet
Sluggable
QueryCache
Timestampable
Third-party behaviors
Equalnest
The author does not seem confident in the compatibility like explained in this issue. I'll create a specific issue #969 to know the state of the art for managing an "equal nest" in Propel2.
Geocodable
A PR has been done here, but no news for a long time...
There is now a dedicated repo for Propel2.
Core source
The typehintable is in the core of Propel2, so it smells good
Third-party bundles
FOSUserBundle
Propel2 integration is related to that issue; as the typehintable behavior is now in the Propel core, I suppose we have to change the schema.xml supplied by default by FOSUserBundle for Propel.
GlorpenPropelBundle
It seems not compatible for the moment as explained here, but I suppose it would be better to discuss all the subjects covered in this fantastic bundle in a dedicated issue to know how Propel2 manage these problematics.
FosElasticaBundle
Even for Propel1, this bundle was a little bit hard to use, I suppose we have to work for Propel2.
Full links & discussion on github / https://github.com/propelorm/Propel2/issues/966

Related

Is possible to mix Symfony2 CMF and the standard distribution?

We're planning a new intranet for our organization. Some part is like a CMS, and there are some custom-made applications.
The Symfony2 CMF distribution looks fine for building the CMS part of the intranet, but other parts like Doctrine, "normal" SQL databases, etc, looks better for the custom-made applications for the intranet.
Because I need common authorization and authentication system for this intranet (against an Active Directory), I supose that I'll get better results building all in only on app. So, can I mix a CMF application with a normal application, and both use the same database (an Oracle DB)?
Yes you can easily mix the CMF with other Bundles. For example the routing allows using both routes from the CMF as well as "static" routes defined in yml files. Also you can easily also add the ORM next to PHPCR ODM. If you use Doctrine DBAL for storage in PHPCR, you can even reuse the same connection configuration with the ORM etc.
In brief yes it is, and I do this in my own Symfony2 project. I combine both SF-SE and SF-CMF bundles.
In fact, with Symfony2 it's very simple (this is just a matter of choosing the most suitable Bundles; SF is a very decoupled framework, which is why I don't plan to migrate to any other solution for the moment), but I'd like to share some of my experience with doing that. Actually the one most important question to think through to make a decision about how to combine both "worlds" is this:
Composer.
After some inquries I found out that since Symfony CMF is (in a way) based on Symfony SE, and not vice versa, it's better to start with the latter, as it contains the most core features (though I did it also in the opposite way, rather not recommended). So just take a SF-SE's composer.json, take a look at bundles from there you need, and then take a look at differences within SF-CMF's composer.json. You should end up with the most suitable set of bundles.
The basic features from these bundles to look-up for are:
MODEL - Doctrine ORM, PHPCR-ODM, or both - if still not sure, don't hesitate to ask a comment, I'll share here my experience furthere.
ROUTING - the primary question here is how flexible routing do you actually need? If not sure, I'd go with standard SF Router, and then possibly replace it e.g. when still on a dev stage.
OUT-OF-THE-BOX CMS FUNCTIONALITY - bundles such as CreateBundle, MenuBundle or MediaBundle may help you building surprisingly fast, but not quite flexible soltions. In general, I ended up without using most of them, and if using, then I mainly take some Interfaces I do implement in my own Bundles (to ensure future compatibility with possible other bundles to be potentially used).
Besides of these above, I created a number of Bridge Design Pattern and Provider Design Pattern solutions to make some bundles working together, to adjust their functionalities, or simply to decouple things.
In programming almost everything is possible. But think about restrictions delivered with CMF (routing for eg.).
Maybe you should consider Standard Symfony with Sonata? I think CMS pages it's only small part of your system and implementation it in standard symfony will take smallest part (and cost) of whole project.

Symfony2 user manager bundles?

Which are the best user manager bundles for Symfony 2 and why?
I only know FOSUserBundle.
Are there other good bundles for managing users?
(like it was sfDoctrineGuardPlugin for Symfony 1)
I need not a final, closed solution, but the pros and contras for someone to be able to choose the best bundle depending on his needs.
Firstly, i wrote an UserBundle implementation for my requirements, after i discovered FOSUserBundle and i learned best practices from it.
I think FosUserBundle is a good choice for user manager in Symfony 2. Because
Actively maintained and supported
Provides command line commands for creating new user, activating, promoting etc.
Built-in forms, controllers and views for user related actions.
Supports Doctrine, Propel, CouchDB and Mongo for persistance.
Localization, translations
Optional features like email activation
Supported by other bundles like Sonata bundles
I never worked with other UserBundle, but i highly recommend to use FOSUserBundle.

using symfony bundles

I am new to symfony, so may be it's not a good question...
If any symfony1 plugin works in Symfony2?
How to install new bundle in Symfony2 or where can I learn about it?
Is there any good place to look after bundles?
Is there a bundle for resizing images?
No. Symfony2 is completely different. But some symfony1 modules have been ported to Symfony2.
Usually each bundle provides instructions for setting it up. Take a look at ElnurBlowfishPasswordEncoderBundle for an example.
KnpBundles is the de-facto place for searching bundles.
http://knpbundles.com/search?q=imag

Symfony2 and Frontend & Backend Bundles

Couple of month ago I got a legacy project written on Sf2. I fixed some bugs, and added some new functionality, but still i feel that it was made a little bit clumsy. Well, maybe not just a little :) So, I have a number of questions, how things really should be done in Sf2.
The first thing which is bothering me, is that the Application is separated on Frontend and Backend bundles. The're standing on the same model, and for example entity Book can be seen from FrontendBundle and edited from BackendBundle. In some way this is producing a confusion of abstractions. So my question is - is it right, or wrong, and if wrong how it should be done in appropriate way?
Bundles are components in symfony2 that provides a functionality to your app. The frontend and backend approach has changed in symfony2, the bundles are used instead.
For example, you can create a BookBundle, and put all the functionality regarding to books in that bundle, adding, updating etc. And by configuring the routes, you can redirect all the requests about the book to that bundle.
The main point is, the frontend and the backend about the books resides in same bundle, and only in that bundle(with controllers and entities and repositories and views etc.).
This is the intended usage in symfony2.

Symfony2 Backend?

I am new to Symfony, please don't scold me about this question.
I read in a Symfony 1.4 book that there is a functionality of adding backends to your applications via doctrine:generate-admin or generate:app backend, implementing CRUD operations.
Now I wonder, is there anything similiar with Symfony2.0?
Basically I have an user management and a database in the background that I would love to have available for my Admin Users, but do I have to code it myself (i.e. securing the are /admin, creating templates, classes, methods etc. that fulfill this tasks) or can it be done more easy by using some kind of an already existing backend functionality?
Thanks!
EDIT: Also read there's a plugin called "Apostophe" - but isn't there anything included with SF2 or are there any preconfigured SF2 Versions that already come with Backend solutions?
There's the SonataAdminBundle (and possibly a few more I haven't seen) that helps provide an admin system, however this area is still being worked on heavily by the Symfony2 community.
Lukas has put together a blog article on the current state of development of a Symfony2 CMF, with some rough timescales - State of the Symfony2 CMF
Hope this helps!
Also there is another bundle for managing the admin. You can take a look here http://knpbundles.com/cedriclombardot/AdmingeneratorGeneratorBundle
For "admin generation", Symfony2 is not yet with the code generation on that aspect. The base is VERY STRONG. Remember Symfony2 is still at 2.0 stage. (Not 2.1++ like symfony1).
If you want cut and paste code. Symfony2 is not exactly for that.
DISCLAIMER
I am more specialized in frontend than backend, but I got around stuff. But Thanks to Symfony2. I can be on both sides. So I speak from this context.
CAVEATS
What I call "good stuff".
Only using ONE {{ form_widget(form) }} that Symfony form documentation recommends ... and not explictly cut and pasting from the Twig tutorial that is /meant/ to show how to do theme... not to implement like it is shown.
Thinnest controller methods possible
... out of scope of this post.
SO
My best advice is serious RTFM, a few times, with Symfony books. It is scary, but I am working with it since three months and re-reading a lot. Everytime I get excited with gems.
ANSWER IN QUESTION
My current choice of bundles is:
FR3DLdapBundle, with FOSUserBundle
MopaBootstrapBundle along with all code generated with HTML/CSS structure Twitter Bootstrap gives. (if you haven't heard of it, yet, where were you?)
AsseticBundle with proper {%- javascript %} inclusion
And the rest is contextual.
My READ and RE-Read list
A hidden gem and very helpful blog posts were for me from:
Problematic's blog post series "On a diet"
Matthias Noback
Liip Symfony2 tagged blog posts, but mostly the Table Inheritance topic
and CraftItOnline
For the sake of completeness there is a native way to generate CRUDs:
php app/console doctrine:generate:crud
This command will ask to you some information, like the entity, if you want a write action, the configuration format or the base route prefix.
In my opinion this is the fastest and light way to quickly generate a controller to create, read, update or delete your entities, so it is good on simple projects or to code a basic CRUD inside a little Bundle.
Official documentation: http://symfony.com/doc/master/bundles/SensioGeneratorBundle/commands/generate_doctrine_crud.html

Resources