Für alle, die immer noch dieses Feed abboniert haben nun hier offiziell, dass dieses Blog nicht mehr aktualisiert wird und ihr nun unter www.neyeon.com neue Updates von mir bekommen werdet.
blogSorry for the language change but at the moment it’s just way more convenient for me ![]()
Since Tobi blogged about the Zend Framework some time ago, I was tempted to try it for myself again and I’m really impressed by the improvements between versions 0.9.x/1.0 and 1.6 (Download). The whole framework has become easier to handle and better structured despite offering a huge number of components.
I lately became a very big fan of object relational mapper frameworks because it fits pretty much every task I had to face by now and allowed me to avoid writing SQL statements and repeatedly mapping it objects (damn, I’m a lazy programmer ;). Therefore I was a little dissapointed to discover that the Zend_Db component is not an ORM layer in my understanding of this technology.
Fortunately I followed the development of a very powerful ORM for PHP named Doctrine which became stable not a long time ago.
There are many articles on how to include Doctrine as your model in the Zend Framework (ZF) but due to the rapid development of both frameworks most of them are already outdated (and I guess that this article will suffer the same fate pretty soon, too, even though both frameworks are very mature in my opinion).
I decided to write a tutorial on how to connect Doctrine and ZF by adapting the original quick start tutorial and - as I like it to do with my blog tutorials - splitting it up in multiple parts. The first part will be about the installation, putting both frameworks together and performing the basic steps. The next part will deal with the GuestBook demo from the ZF tutorial.
framework , phpAlle Jahre wieder kommt ein neues Eclipse Release. Es ist zwar schon etwas her, aber manchmal ist es auch nicht schlecht etwas zu warten bis alle verwendeten Plugins angepasst worden sind.
Die Installation meiner Lieblingskombintation mit den EE Tools, PDT und Aptana ist noch etwas umständlich, dafür bekommt man aber die aktuellsten Versionen.
Folgende Schrittemusste ich für die Lauffähige Version vornehmen:
Download Eclipse 3.4 Classic (notwendig für Integration von Aptana)
Befolgen der auf HowToForge beschriebenen Schritte.
Für PDT habe ich den Integration build vom 22.07.2008 geladen (die Abhängigkeiten der neueren Builds waren mir nicht ganz klar).
Für die Installation von Aptana einfach wieder der Anleitung inkl. der Eclipse 3.4 Schritte folgen.
Ich kann nicht genau sagen, ob die Dokumentation für eigene Hibernate Sequence (Primary Key) Generatoren für mich zu überladen, zu spärlich oder einfach nichtssagend war, jedenfalls war es im Endeffekt wesentlich einfacher was zum laufen zu bekommen, als das Beispiel vermuten lässt:
-
package com.example.customid;
-
-
import java.io.Serializable;
-
import java.util.Date;
-
import java.util.Random;
-
-
import org.hibernate.HibernateException;
-
import org.hibernate.engine.SessionImplementor;
-
import org.hibernate.id.AbstractUUIDGenerator;
-
-
public class CustomGeneratorextends AbstractUUIDGenerator
-
{
-
@Override
-
{
-
// Generate some custom pseudo random stuff
-
}
-
}
Der generierte Wert taugt natürlich rein gar nichts als echte unique ID, zeigt aber hoffentlich ein etwas übersichtlicheres Beispiel auf dem man aufbauen kann.
Eine Beispielklasse, die die Hibernate Annotations zur Konfiguration verwendet sieht dann so aus:
-
package com.example.customid;
-
-
import javax.persistence.GeneratedValue;
-
import javax.persistence.Id;
-
-
import org.hibernate.annotations.GenericGenerator;
-
-
public class Dummy
-
{
-
private String id;
-
-
/**
-
* @return the id
-
*/
-
@Id @GeneratedValue(generator="test")
-
@GenericGenerator
-
(
-
name = "test",
-
strategy = "com.example.customid.CustomGenerator"
-
)
-
{
-
return id;
-
}
-
-
/**
-
* @param id the id to set
-
*/
-
{
-
this.id = id;
-
}
-
}
Im dritten und letzten Teil des Subversion HowTo's geht es nun dadrum die konfigurierte Web Darstellung etwas zu verschönern und zu erweitern.
Die schönste und einfachste Variante habe ich in Reposstyle gefunden, wo man von der Seite die aktuellste Version (2.0b funktioniert bei mir tadellos) laden sollte und den Inhalt nach /home/svn/repository/ entpackt.
Um den Ordner mit den Dateien verfügbar zu machen muss nun zuerst einmal der Alias /repos-web in der Apache Konfiguration gesetzt werden:
Alias /repos-web /home/svn/repository/repos-web/
<Directory /home/svn/repository/repos-web/>
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Ebenfall in der Konfiguration muss die Location Direktive für das SVN um die Zeile
SVNIndexXSLT "/repos-web/view/repos.xsl"
erweitert werden.
Nun sollte nach einem Webserver Neustart das Repository schon in neuem Glanz erscheinen.
Ein weiteres nettes Feature von Reposstyle ist die Anzeige der letzten History Einträge mit einem PHP Skript.
Dazu muss man die /home/svn/repository/repos-web/open/log/index.php editieren und die Variable in unserem Fall auf
$repo = "file:///home/svn/repository/";
setzen.
Dort sieht man dann mit einem Klick auf Folder history die letzten x (Anzahl ebenfalls in der index.php über die Variable $limit einstellbar) Commit Einträgen inklusive Kommentaren und den aktualisierten Dateien. Meiner Meinung nach ein sehr nützliches Feature fürs Repository Browsing.













