This is part 4 (of 4) of an introduction to the use of ArangoDB together with Symfony 2. You’ll find the links to the other parts of this tutorial at the end of this text.
You can download the completed demo at Github.

Extending Arangodb\Document

The next thing we want to improve are all those noisy set calls in the controller:

The fix is pretty obvious. $movie is an instance of triagens\ArangoDb\Document and we can extend it.

The final add action

We have now moved the conversion of the topic list between the form representation (string) and our app data representation (array) to a data transformer (Symfony feature). We have also extended Arangodb\Document to get rid of the set methods in the controller. Now our code looks like this:

Using ArangoDB query language

The last example in this tutorial shows how you can use ArangoDB’s query language which can also handle very complex queries (AQL manual)

The AQL query to search for the topic “romance” looks like this:

Our tiny “search for topic” feature in PHP gets the wanted topic from the search form (not shown here, but you can look it up in the code repository on Github). You have to bind it to the statement as you would do with many other database layers, execute it. Done.

ArangoDB and Doctrine

We are currently discussing if the community would like a ArangoDB integration into Doctrine. We would love to hear your thoughts in the comments, via twitter, google group, mail, whatever … you’ll find a way 🙂

The end

Congrats, you have reached of the last part of the tutorial.