How to work with Symfony 1.1(dev) and Doctrine 1.0

21 11 2007

For running Symfony 1.1 development version in parallel to your 1.0.x installation you may refer to http://www.symforc.com/post/2006/08/01/Testing-Symfony-11. It explains everything you need in great detail.

For running a 1.1Dev version only project you do:

cd /usr/share/pear/
svn co http://svn.symfony-project.com/trunk/lib symfony
svn co http://svn.symfony-project.com/trunk/data data/symfony

In my case I use /usr/share/php/ rather than /usr/share/php.

Now you have to choose whether to run a real symfony installation or to just run a sandbox.

For a sandbox:

Go to the directory where you want to place your sandbox and run:

$ /usr/share/pear/data/symfony/bin/create_sandbox.sh

For a real installation:

Make a softlink from /usr/bin/symfony to /usr/share/pear/data/symfony/bin/symfony Go to the directory you want to start your project in and run:

$ symfony generate:project <your_project_name>

Now install sfDoctrinePlugin:

In your projects root directory you checkout the trunk of sfDoctrinePlugin by running:

$ svn co http://svn.symfony-project.com/plugins/sfDoctrinePlugin/trunk plugins/sfDoctrinePlugin

This will effectively install the correct version of doctrine corresponding to your Symfony installation.

Beware sometimes you can get the following error:

Fatal error: Class 'sfDoctrineBaseTask' not found in
/var/www/localhost/plugins/sfDoctrinePlugin/lib/task/
sfDoctrineInitCrudTask.class.php on line 18

To solve this you have to remove all files from /tmp that have ’sf’ or ’symfony’ or ‘cache’ in their name. this is a bug in Symfony 1.1 that keeps some informations persistent in /tmp that are no longer valid.

Not too much information here but it took me a while to figure it out. ;)

Thanks to Ian P. Christian for pointing me towards the /tmp solution!

Powered by ScribeFire.

, ,


Routing international URLs in Symfony

29 08 2007

Symfonys I18n support is pretty neat once you’ve got the hang of it. The one thing I always missed was to have a set of URLs per culture in order to name the urls in different languages.

Consider the following: You have to build an application that is served in English, French and German.

Now you would probably name your starting page ‘homepage’. But then it would be nice to call it ‘pagedaccueil’ for your french visitors and ’startseite’ for the german speaking, wouldn’t it?

For example with this routing you can achieve just that.

homepage:
  url:
    de:   /startseite
    en:   /homepage
    fr:   /pagedaccueil
  params: [ module: home, action: index ]

Well with a bit of tweaking I managed to find a way to achieve this. It’s currently not too easy to extend the originally shipped sfRouting,you have to use a filter to achieve that but from there it’s easy.

The slightly enhanced UrlHelper functions are not yet well documented and probably not very complete either but then again I will come round to better them as time will come and request will be made.

Oh and of course you can still have your old routes working as before. I18n routes are an optional feature you get with this plugin.

Find out more about csI18nRoutingPlugin here.

, , , , , , ,


sfTwitterPlugin - Microblogging in Symfony

25 07 2007

to be completed soon..

Powered by ScribeFire.



Javascript Design Patterns - 1. The Singleton

1 03 2007

This being the first part of a series of posts that I plan to write (hopefully) I will provide bits of basics as well. So on the way to implement a Singleton pattern I also briefly show how to create classes and how to have public as well as private attributes and methods.

Read the rest of this entry »

, , , , , , , , ,


Installing Eclipse as your IDE for developing PHP webapplications

1 03 2007

During the last couple of month I had to install my development environment over and over again. On my private as well as on work computers. It took me a while to find the ideal setup for myself and in the process of that I tried and tested many plugins.

This is to describe my current Eclipse setup for developing web applications. Techniques used include Javascript, XHTML, CSS, PHP, MySQL, XUL and Subversion.

Read the rest of this entry »

, , , , , , , , , , , , , , , , , , , ,


Messaging - Object interaction on custom events

21 02 2007

message.js

How can we implement a messaging service in Javascript to enhance encapsulation of classes? This post shows my idea of the implementation and how to use it.

Read the rest of this entry »



Extending PHP5’s XMLReader for server-side validation and localization of XHTML files

11 02 2007

Introduction

Just recently a collegue of mine (thanks Kai-Ingo) introduced me to PHP5’s XMLReader library. I have to admit that I probably missed a lot of new extensions lately but if you look into the online documentation over at php.net you can see that there are a lot of them, certainly more than there were when I first started with PHP2. The last novelty I enjoyed being added to PHP5 was SimpleXML which by far improves XML handling in PHP in comparision to SAX.

Read the rest of this entry »

, , , , , , , , , , , ,


Stair-climbing robot

8 12 2006

A friend of mine recently posted a puzzle he took from Lambda the Ultimate and asked several people to send in possible solutions in their favourite language. My choice was Javascript naturally and I’m quite fond of it. After some discussion the solution seems to be approved by everyone included in the original thread.

Your stair-climbing robot has a very simple low-level API: the “step” function takes no argument and attempts to climb one step as a side effect. Unfortunately, sometimes the attempt fails and the robot clumsily falls one step instead. The “step” function detects what happens and returns a boolean flag: true on success, false on failure. Write a function “step_up” that climbs one step up (by repeating “step” attempts if necessary). Assume that the robot is not already at the top of the stairs, and neither does it ever reach the bottom of the stairs. How small can you make “step_up”? Can you avoid using variables (even immutable ones) and numbers?


taken from Lambda the Ultimate.

Read the rest of this entry »

, , ,