Linking Symfony2 with Solr - php

It's clear, how to plug Solr in Symfony2 framework? I found some resources out there but they're totally unclear or incomplete. There supposed to be a Symfony2 bundle named NelmioSolariumBundle but can't get it well, poor documentation.
If you have done this operation, please give us the How-to answer in few Get-started steps, or any good straightforward documentation/tutorial will be appreciated.

Solr can be easily connected through it's REST interface, so if you have an easy use case, you might only have to use a PHP library that can talk to solr.
I use this library hosted on google code. Also I'm working on a solr bundle wich provides a convenient way of indexing doctrine entities, it can be found here but it's also work in progress and almost no documentation....
The functionality so far is limited to index entities by cli and doing standard search. I'm currently using it in another bundle to index a geo database and providing an autocomplete form type for locations, you could check out the code for figure out the usage here...
If my bundle is not of any help, you might get an idea of how to create your own implementation.

Related

Symfony solr bundle 2.8 +

I started to get data from solr with curl but this is not the symfony way and I want to change that before is "to late".
There is most popular nelmio solr bundle (this is info I found from googling) i also found some other bundles, but wanted to pleased you to help me in choosing nelmio or suggest some better bundle that is fully support also and symfony 3.0
First off: Using NelmioSolarBundle and floriansemm/SolrBundle have very different use cases.
NelmioSolrBundle is just a symfony integration of the solarium library, which is nothing more than a wrapper around those direct curl requests.
The SolrBundle by floriansemm integrates solr deeper into the framework by making annotations available to declare which entity fields i.e. are stored or indexed in solr (done via dynamic fields). I found the options using normal schema.xml definitions are way more powerful since not everything is available there.
In my current project i first tried using SolrBundle but ran into some limitations which led me to switch to NelmioSolariumBundle. (so my solr config and schema are maintained directly in the solr and not through annotations and so on)
Once you get used to the solarium library (http://www.solarium-project.org/) the nelmio bundle works fine but in the end it's nothing more than a fancy way of executing those curl requests.
So if your implementation works, keep using it.
Hope this helps.

How to upgrade symfony from 1.4 to 2.1? [duplicate]

I've got a huge site that has been written (in a very bad way) in symfony 1.4
now, I've been asked to make some substantial changes to the navigation flow, add some features and so on..
considering the effort, I was wondering if it would be better to take the radical decision to port the entire website to symfony 2.0, but I'm not sure how hard that it could be.
Has anybody ever done this before?
Do you have any suggestion to make for patterns to follow, or tutorials or doc or whatever?
You may wrap your legacy project in a brand new sf2 project, by using this bundle. This way, you'll be able to migrate your project one piece at a time, and new functionalities may be developed with sf2 as soon as you get the wrapper to work.
You may be interested by this post about migrating
Here's how I would go about it:
You need to learn and study some things first:
HTTP fundamentals
PHP namespaces, which are heavily used
Symfony2 documentation
Symfony2 documentation
Symfony2 documentation
PHPUnit documentation
Then when you get the hang of Symfony2, you need to find out what to reuse from your old project:
Models, business logic?
Did you use Doctrine in symfony? If yes, look at how to port your entities to Doctrine2, and learn about the differences. If you used Propel, I would look at switching to Doctrine2 and not use the PropelBundle, atleast until you get used to Symfony2. You can find better documentation and sample code out there for Doctrine2.
You also need to convert your old helpers classes to Symfony2 services.
Views?
Symfony2 uses Twig as templating engine, but you could go with pure PHP.
Controllers?
This should feel somewhat similar to symfony. The flow of Symfony2 matches the HTTP flow, meaning you get a Request object and must reurn a Response object.
It really depends on how well structured our old project is. Symfony2 is an entirely different beast than 1.0-1.4. I would probably not call it a port, but a rewrite - however, if your old project is well structured you could probably reuse quite a bit.
Without actually seeing your code, it's impossible to give a good answer on how hard it would be. It's very much doable, but there is no easy route. Symfony2 is, IMHO, the way of the future for PHP projects and in the end you will get a project that is much easier to maintain and support.

Porting a website from Symfony 1.4 to 2.0

I've got a huge site that has been written (in a very bad way) in symfony 1.4
now, I've been asked to make some substantial changes to the navigation flow, add some features and so on..
considering the effort, I was wondering if it would be better to take the radical decision to port the entire website to symfony 2.0, but I'm not sure how hard that it could be.
Has anybody ever done this before?
Do you have any suggestion to make for patterns to follow, or tutorials or doc or whatever?
You may wrap your legacy project in a brand new sf2 project, by using this bundle. This way, you'll be able to migrate your project one piece at a time, and new functionalities may be developed with sf2 as soon as you get the wrapper to work.
You may be interested by this post about migrating
Here's how I would go about it:
You need to learn and study some things first:
HTTP fundamentals
PHP namespaces, which are heavily used
Symfony2 documentation
Symfony2 documentation
Symfony2 documentation
PHPUnit documentation
Then when you get the hang of Symfony2, you need to find out what to reuse from your old project:
Models, business logic?
Did you use Doctrine in symfony? If yes, look at how to port your entities to Doctrine2, and learn about the differences. If you used Propel, I would look at switching to Doctrine2 and not use the PropelBundle, atleast until you get used to Symfony2. You can find better documentation and sample code out there for Doctrine2.
You also need to convert your old helpers classes to Symfony2 services.
Views?
Symfony2 uses Twig as templating engine, but you could go with pure PHP.
Controllers?
This should feel somewhat similar to symfony. The flow of Symfony2 matches the HTTP flow, meaning you get a Request object and must reurn a Response object.
It really depends on how well structured our old project is. Symfony2 is an entirely different beast than 1.0-1.4. I would probably not call it a port, but a rewrite - however, if your old project is well structured you could probably reuse quite a bit.
Without actually seeing your code, it's impossible to give a good answer on how hard it would be. It's very much doable, but there is no easy route. Symfony2 is, IMHO, the way of the future for PHP projects and in the end you will get a project that is much easier to maintain and support.

Which MongoDB library to use for a stand-alone PHP project with Symfony?

I am leading a new project where we're convinced that MongoDB is the right choice for database. We have decided that the architecture would be SOA, so the web part will be developed using Symfony and the service part will be developed using light-weight REST framework Tonic.
Now, in the service part, we'll be communicating with MongoDB and for that, we have looked into a number of available MongoDB libraries: Doctrine MongoDB ODM, Mondango, ActiveMongo, MongoRecord, etc. However, we are not sure which one to pick.
I was wondering if anyone can share their experience with these libraries so that we can make the right choice. Here are some of the properties we consider the library should have:
Plain PHP classes for defining documents (instead of array/config files)
Support for references
Efficiency in operations
Easy to understand API
Looking forward to your views!
Personally I would go with Doctrine2 ODM. Seen as you have already decided on Symfony as your framework for doing the heavy lifting the pair are well aligned as far as I understand. You should be able to use this https://github.com/doctrine/DoctrineMongoDBBundle to integrate the two pretty quickly.
The doctrine setup ticks all the boxes you've set for your project goals and is fairly easy to get working with. Most importantly, it's an active project so bug fixes/features/documentation updates happen fairly regularly.
We use a similar setup, except zend framework instead of Symfony, and we're very happy with the results.
Hope this helps.

php framework with sqlite, orm, i18n, l10n search addon

I'm trying to find a PHPframework to build small, multilingual sites.
Do you know a PHP framework with support for:
Sqlite (it will be little sites so no performance problem and good for copy-paste from development to production)
ORM
i18n & l10n
easy search add-on
ability to just copy-paste no need to change config for going from devel machine to production (staging)
and if you know cms with those features put it too.
Symfony 1.4.x comes with all this built it, except for searching which can be implemented using Lucen.
It has great documentation that walks you through the entire process of making a real and useful website using all the features you've mentioned. See it here.
I am also searching for such a Framework. I found one called YII. It makes use of SQLITE by default. Very easy to setup. But I am not sure if it has all the features that you are looking for.
Link to Site: http://www.yiiframework.com/download/
Detailed Documentation is also available fro reference.

Categories