<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>php&#124;architect - The site for PHP professionals &#187; ORM</title>
	<atom:link href="http://www.phparch.com/tag/orm/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.phparch.com</link>
	<description>Just another WordPress site</description>
	<lastBuildDate>Fri, 10 Feb 2012 15:11:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>ORM Designer</title>
		<link>http://www.phparch.com/2010/05/orm-designer/</link>
		<comments>http://www.phparch.com/2010/05/orm-designer/#comments</comments>
		<pubDate>Wed, 12 May 2010 17:00:41 +0000</pubDate>
		<dc:creator>Marco Tabini</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[cakephp]]></category>
		<category><![CDATA[doctrine]]></category>
		<category><![CDATA[ORM]]></category>
		<category><![CDATA[propel]]></category>
		<category><![CDATA[symfony]]></category>
		<category><![CDATA[zend framework]]></category>

		<guid isPermaLink="false">http://www.phparch.com/?p=5289</guid>
		<description><![CDATA[ORM Designer is a tool for graphical creation and editing of Doctrine and Propel models and metadata.]]></description>
			<content:encoded><![CDATA[<p><a href="http://beta.phparch.com/wp-content/uploads/2010/05/ormdesigner.png"><img class="alignleft size-full wp-image-5375" title="ormdesigner" src="http://beta.phparch.com/wp-content/uploads/2010/05/ormdesigner.png" alt="" width="150" height="150" /></a>The support of object-oriented programming in PHP 5 opened the field for new kinds of general-purpose libraries, and in particular for object-relational mappers used to persist the objects used throughout a PHP application in a classic relational database such as MySQL or PostgreSQL.</p>
<h2>Metadata specification</h2>
<p>For an ORM to work, there are different data models that has to be kept in sync: the object model defined in the PHP source code, the relational model represented by the database schema, and the mapping metadata which configures the ORM to translate between the two.</p>
<p>As with all duplication problems, some of this models may be derived from their equivalents. For example, the simplest ORMs infer the object model from the list of tables in the specified database. There are more sophisticated approaches, like defining at least the metadata to configure the ORM and generate the object and relational model from these mapping configuration. Doctrine 1 and other ORMs makes wide use of this technique.</p>
<p>An even more resilient approach is to define explicitly an object model and its metadata in the form of annotations embedded in PHP code or XML documents, and to generate only the relational schema (as Doctrine 2 does.)</p>
<h2>Visual design of metadata</h2>
<p>The application reviewed in this article, <a title="ORM Designer official site" href="http://www.orm-designer.com/">ORM Designer</a>, is a visual design tool for PHP object-relational mappers. Developers can define an unified model via a graphical interface, and derive the ORM configuration (object and relational model plus the mapping metadata) automatically from the unified model.</p>
<p>Visual designing tools have to be taken with a grain of salt, as there is no fine control over their results when used for code generation. Furthermore, the generated products have to be kept in sync with the evolving unified model via regeneration, and this raises issues with further editing.</p>
<p>ORM Designer pays particular attention to these issues. The unified model is stored in human readable XML, and it is the source of all the generated code. The advantage of XML over a binary format resides in the possibility of diffing different versions of the model and storing it efficiently in source control systems. Of course this unified model can be exported in a format thatcan be understood by the ORM. In the case of Doctrine, which is the primary target of this designing tool, Yaml would be the format of choice.</p>
<p>The ORMs currently supported by ORM designer are <a title="Propel ORM homepage" href="http://www.propelorm.org/">Propel</a> and <a title="Doctrine ORM homepage" href="http://www.doctrine-project.org/">Doctrine</a>, plus the model system of CakePHP (Zend Framework and symfony projects usually employ Doctrine to implement ORM functionalitites). Support for Doctrine 2 is under development, because due to the versatility of the ORM there are some issues in implementing visualization for features like inheritance and annotations.</p>
<p>ORM Designer runs on nearly every platform: Windows, Mac OS X and Linux with wine. I have tried it on Ubuntu 10.04 and there no issues on functionality nor slowness due to the use of wine. The graphical interface is very close to the simplicity of Microsoft Access, but of course the generated source code is much more powerful as it can be used on many different enterprise database vendors.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phparch.com/2010/05/orm-designer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>First beta of Doctrine 2 released</title>
		<link>http://www.phparch.com/2010/04/first-beta-of-doctrine-2-released/</link>
		<comments>http://www.phparch.com/2010/04/first-beta-of-doctrine-2-released/#comments</comments>
		<pubDate>Wed, 28 Apr 2010 19:00:03 +0000</pubDate>
		<dc:creator>Marco Tabini</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[doctrine]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[oop]]></category>
		<category><![CDATA[ORM]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.phparch.com/?p=5131</guid>
		<description><![CDATA[Doctrine 2's first beta release is out. We will take a look at how this Orm lets you almost ignore the existence of a database.]]></description>
			<content:encoded><![CDATA[<p><a href="http://beta.phparch.com/wp-content/uploads/2010/04/doctrine-logo1.png"><img class="size-thumbnail wp-image-5134 alignleft" title="doctrine-logo" src="http://www.phparch.com/files/2010/04/doctrine-logo1-150x150.png" alt="" width="150" height="150" /></a>The first beta of Doctrine 2, the generic Data Mapper for PHP, <a title="Official announcement" href="http://www.doctrine-project.org/blog/doctrine-2-0-0-beta1-released">has been released</a> today. Doctrine 2 is one of the few object-relational mappers for PHP which implement the <a title="Data Mapper pattern" href="http://martinfowler.com/eaaCatalog/dataMapper.html">Data Mapper</a> pattern instead of the <a title="Active Record pattern" href="http://en.wikipedia.org/wiki/Active_record_pattern">Active Record</a> one; as a result, it is expected to be revolutionary for PHP development as much as Hibernate was for the Java world. For example, Symfony has chosen Doctrine as its default Orm and will follow-up with its second major version, while Zend Framework will provide integration of Doctrine 2 in the form of application resources.</p>
<h2>The abstraction of having every object available in memory</h2>
<p>The Data Mapper pattern is in general very flexible: you can create domain classes as Plain Old PHP Objects, which do not extend any abstract base class; subsequently a Data Mapper layer abstracts the database as a generic storage. Though, application-specific Data Mappers are generally boring and repetitive to write, while also being prone to errors.</p>
<p>With Doctrine 2, you still produce an object model and, with the aid of mapping metadata in the form of small XML files or annotations, the schema of the related relational database  is inferred, while the client code in the rest of the application lives the illusion of an in-memory object graph.</p>
<p>You can largely ignore the database, considering it an implementation detail. The schema can be generated and created from the command line, and there are more than one thousand unit tests to target the different database management systems used as back ends (MySQL, Postgresql, Oracle, Sqlite) to avoid unpleasant surprises. Depending on your vendor of choice, database-specific SQL code will be generated for the creation phase and during querying.</p>
<h2>Underlying technology</h2>
<p>Doctrine 2 goes to a great extent to avoid introducing unnecessary code for persistence purposes only. The objects&#8217; content are accessed and reconstituted via reflection, avoiding the use of getters or initialization methods, while part of the object graph can be substituted by lazy-loading proxies which take the place of real objects by dynamically subclassing them; however performance can be problematic if you over use this feature. Moreover, this first beta of Doctrine 2 is the first to <a href="http://whitewashing.de/blog/articles/128">support constructors with non-optional arguments</a>; objects are recreated via cloning to bypass the constructor call, further extending the metaphor of objects that never leave memory.</p>
<p>If you have already been using Doctrine 2 in its alpha stage, there is a <a title="What's new in Doctrine 2 beta" href="http://www.doctrine-project.org/upgrade/2_0">guide to the upgrade</a> from the alpha 4 version. The <a title="Doctrine 2 user's manual" href="http://www.doctrine-project.org/documentation/2_0/en">official documentation</a> is also fairly good for a project which is not yet officially stable. If you want to contribute to the codebase instead, the development has been moved on <a href="http://github.com/doctrine/doctrine2">github</a> and only a fork divides you from producing a useful patch.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phparch.com/2010/04/first-beta-of-doctrine-2-released/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Impel, the Javascript ORM</title>
		<link>http://www.phparch.com/2010/03/impel-the-javascript-orm/</link>
		<comments>http://www.phparch.com/2010/03/impel-the-javascript-orm/#comments</comments>
		<pubDate>Tue, 23 Mar 2010 11:30:18 +0000</pubDate>
		<dc:creator>Marco Tabini</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mootools]]></category>
		<category><![CDATA[ORM]]></category>
		<category><![CDATA[sqlite]]></category>

		<guid isPermaLink="false">http://www.phparch.com/?p=4457</guid>
		<description><![CDATA[Impel is an object-relational mapper for JavaScript. If the association of these two terms seems strange, bear with me (and with HTML5) for a moment.]]></description>
			<content:encoded><![CDATA[<p><a href="http://beta.phparch.com/wp-content/uploads/2010/03/impel.png"><img class="alignleft size-full wp-image-4458" title="impel" src="http://beta.phparch.com/wp-content/uploads/2010/03/impel.png" alt="" width="150" height="90" /></a><a title="Impel official site" href="http://impel.simulacre.org/">Impel</a> is an object-relational mapper for Javascript, which takes advantage of the future native support of browsers for relational client-side databases.</p>
<h2>Background</h2>
<p>The in-development <a title="HTML% specification" href="http://dev.w3.org/html5/spec/Overview.html">HTML5 specification</a> is becoming more and more supported by browsers such as Firefox, Safari and even Internet Explorer. Together with other standardizations, the <a title="HTML5 Web SQL Database specification" href="http://dev.w3.org/html5/webdatabase">specification</a> defines a per-host relational database for data storage on the client side, to be accessed via JavaScript without any additional requirement than <a title="Structured Query Language" href="http://en.wikipedia.org/wiki/SQL">SQL</a> knowledge.<br />
Currently <a title="SQLite official site" href="http://en.wikipedia.org/wiki/SQLite">SQLite</a> is used by all the browsers&#8217; implementations, as it is the most popular lightweight relational database.</p>
<p>However, the available data model is not really limited to the relational one.</p>
<h2>The solution</h2>
<p>As often is the case, where there is a relational database, there is also an <a title="Object-relational mapping definition" href="http://en.wikipedia.org/wiki/Object-relational_mapping">object-relational mapper</a>. In JavaScript every variable is an object, so it makes sense to build an object-oriented application model, and transparently persist the data.</p>
<p>Thus the need for a DataMapper, like Impel, to store these objects automatically in the native database via metadata provided in the source code. Of course Impel comes with an automatical synchronization package for updating the rapidly changing schemas distributed all over the client machines. And it runs on the iPhone, as the authors <a title="Impel FAQ" href="http://impel.simulacre.org/crm/faq">like to point out</a>.</p>
<h2>Technology overview</h2>
<p>Impel is built over <a title="MooTools official site" href="http://mootools.net/">MooTools</a>, which is a required dependency. The API is modeled on <a title="Propel official site" href="http://propel.phpdb.org/trac/">Propel</a>. Propel was one of the first object-relational mappers for PHP 5.</p>
<p>The original API is modified to accommodate an asynchronous model, which the JavaScript interpreters require. Blocking calls in JavaScript do not work very well, since with the usage of simple method calls the browser would effectively freeze while expecting that the database computes and returns its query result. <em>Asynchronous model</em> means that handlers (anonymous or named functions) are registered on querying, and are called when the result is available, fitting in the event-driven paradigm of JavaScript programming.</p>
<p>Impel is indeed a bleeding edge technology, but a standout in the new HTML5 environment. It fills the gap between JavaScript objects and the native local storage of HTML5, a significant feature especially for early adopters.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phparch.com/2010/03/impel-the-javascript-orm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

