Skip to end of metadata
Go to start of metadata

<p>This is a page for planning Doctrine integration.</p>

<h1>Doctrine 1</h1>

<h2>Questions</h2>

<ul>
<li>What minor version number of Doctrine 1.x should we support? (kpope)</li>
<li>What namespace should we use?
<ul>
<li>Right now I think about something like Zend_(orm|model)_Doctrine, to make it possible for future orm's (juozas)</li>
</ul>
</li>
<li>How should we modify Record/Table generation tasks in the light of ZF Modular Structures
<ul>
<li>Configurable via Metadata?</li>
<li>How can we autoload this correctly given <Record>Base instances (side by side or in Subdirectory?)
<ul>
<li>Models can be generated to Model_Class, Model_Base_Class and Model_ClassTable so autoloading shoudln't be a problem (juozas)
<ul>
<li>How does would this look like for ModuleA_Model_Class, ModuleB_Model_Class? How could one configure which class is for which module? (beberlei)</li>
</ul>
</li>
</ul>
</li>
<li>I'm not aware of any way to generate modular models using Doctrine 1.1, This may be possible with 1.2. See <a href="http://www.doctrine-project.org/upgrade/1_2#PEAR%20Style%20Model%20Loading%20and%20Generation">http://www.doctrine-project.org/upgrade/1_2#PEAR%20Style%20Model%20Loading%20and%20Generation</a>, <a href="http://groups.google.com/group/doctrine-user/browse_thread/thread/a6f4751b9a8e47dc#">http://groups.google.com/group/doctrine-user/browse_thread/thread/a6f4751b9a8e47dc#</a> and <a href="http://groups.google.com/group/doctrine-user/browse_thread/thread/3fe6f7745d472a46">http://groups.google.com/group/doctrine-user/browse_thread/thread/3fe6f7745d472a46</a> (mlurz71)</li>
</ul>
</li>
</ul>

<h2>Todo</h2>

<ul>
<li>Create a Doctrine 1 Zend Application resource (mlurz71)
<ul>
<li><a href="http://framework.zend.com/wiki/display/ZFPROP/Zend_Application_Resource_Doctrine+-+Matthew+Lurz">http://framework.zend.com/wiki/display/ZFPROP/Zend_Application_Resource_Doctrine+-+Matthew+Lurz</a> already exists</li>
<li>I have code for this, though it should make use of application.ini config to set it's properties (juozas)</li>
</ul>
</li>
<li>Create a Doctrine1 paginator adapter
<ul>
<li>Juozas could contribute his.
<ul>
<li>current code <a href="http://pastebin.com/f39a326dd">http://pastebin.com/f39a326dd</a> (juozas)</li>
</ul>
</li>
<li><a href="http://framework.zend.com/wiki/display/ZFPROP/Zend_Paginator_Adapter_Doctrine+-+Jason+Eisenmenger">http://framework.zend.com/wiki/display/ZFPROP/Zend_Paginator_Adapter_Doctrine+-+Jason+Eisenmenger</a> already exists (mlurz71)</li>
</ul>
</li>
<li>Create a Doctrine1 auth adapter
<ul>
<li><a href="http://www.framework.zend.com/svn/framework/extras/incubator/library/ZendX/Doctrine/Auth/Adapter.php">http://www.framework.zend.com/svn/framework/extras/incubator/library/ZendX/Doctrine/Auth/Adapter.php</a> exists already, only docs and tests missing.</li>
</ul>
</li>
<li>Create Zend_Tool providers for Doctrine 1
<ul>
<li>Should be zfproject.xml aware and use the Doctrine 1 resource to "bootstrap" the ZF + Doctrine enviroment</li>
<li>Should implement all the tasks that the Doctrine CLI has.
<ul>
<li>Import Task should be extended to allow for modularity and PEAR Style class generation, a potential Schema would be <Module><em>Model</em><Name>, <Module><em>Model</em><Name>Table and <Module><em>Model_Base</em><Name>.</li>
</ul>
</li>
</ul>
</li>
<li><span style="text-decoration: line-through;">Create Zend_Db_Adapters support gateway</span>** Why? I think the performance overhead is considerable, wouldn't it be better to contribute new adapters for Doctrine then? (beberlei)
<ul>
<li>
<ul>
<li>What do you mean by performance overhead? I haven't tried it, but the fact that Doctrine now is very much PDO oriented (correct my if I'm wrong) makes me believe that it would be easier to make some sort of bridge than to recode drivers for Doctrine. I should play with this (juozas)
<ul>
<li>I think the problem is rather that Doctrine requires much more than the PDO/PDOStatement like API but also the Export/Import Requirements for DDL SQL Statements, which might not be correct for the currently unsupported/semi-supported platforms.
<ul>
<li>I guess I've missed this point, you are right (juozas)</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li>Create a Log Writer component (mlurz71)
<ul>
<li><a href="http://framework.zend.com/wiki/display/ZFPROP/Zend_Log_Writer_Doctrine+-+Matthew+Lurz">http://framework.zend.com/wiki/display/ZFPROP/Zend_Log_Writer_Doctrine+-+Matthew+Lurz</a> already exists</li>
</ul>
</li>
<li>Create a Session SaveHandler component (mlurz71)
<ul>
<li><a href="http://framework.zend.com/wiki/display/ZFPROP/Zend_Session_SaveHandler_Doctrine+-+Matthew+Lurz">http://framework.zend.com/wiki/display/ZFPROP/Zend_Session_SaveHandler_Doctrine+-+Matthew+Lurz</a> already exists</li>
</ul>
</li>
</ul>

<h1>Doctrine 2</h1>

<h2>Questions</h2>

<ul>
<li>What namespace should we use?</li>
</ul>

<ul>
<li>Would the doctrine2 classes use 5.3?
<ul>
<li>Doctrine 2 requires 5.3+. See <a href="http://www.doctrine-project.org/documentation/manual/2_0/en/introduction">http://www.doctrine-project.org/documentation/manual/2_0/en/introduction</a> (mlurz71)</li>
<li>Just to clarify I meant do we use 5.3 or 5.2 to create the ZF doctrine 2 components. (kpope)</li>
</ul>
</li>
<li>Replication support? Probably need to ask the Doctrine team about this.
<ul>
<li>What is replication support? Mysql Proxy is the way to go here imho. (beberlei)
<ul>
<li>I agree with beberlei, there are also ways to make use of multiple connections using Doctrine plugins (juozas)</li>
<li>Ok, maybe at the end of the process we can provide an example in the docs for this. (kpope)</li>
</ul>
</li>
</ul>
</li>
</ul>

<h2>Todo</h2>

<ul>
<li>Update the main Zend_Loader_Autoloader to support both 5.2 and 5.3 style class loading.</li>
<li>Update the Zend_Loader_Autoloader_Resource to support namespaces</li>
<li>Create a Doctrine 2 Zend Application resource
<ul>
<li>I have a prototype on this, which is quite complete already. I will create a proposal for it.</li>
</ul>
</li>
<li>Create a Doctrine2 paginator adapter</li>
<li>Create a Doctrine2 auth adapter</li>
<li>Create a zend server cache adapter for the \Doctrine\Common\Cache (submit to Doctrine codebase) or support Zend_Cache?
<ul>
<li>Why share a cache instance? I don't see the point, since there are no global methods on caches that require a "singleton" of a cache. (beberlei)</li>
<li>Sorry I mean we need a Zend Server adapter for the common lib (kpope)</li>
</ul>
</li>
<li>Zend Profiler support?
<ul>
<li>This is a good idea, because it would allow using DC2 with Zend_Wildfire / FirePHP. However the current DC2 Logger only has a subset of features of the Db Profiler. However i might propose to pair this up.</li>
</ul>
</li>
<li>Look at the ZF directory structure, do we need to add any folders etc for metadata for instance?
<ul>
<li>This question is also relevant for DC1 regarding the yaml fixture and metadata files.</li>
</ul>
</li>
<li>Create Zend_Tool providers for Doctrine2
<ul>
<li>I have a prototype for those already, they are zfproject.xml aware and use the Zend_Application instance and Doctrine2 Resource.</li>
</ul>
</li>
<li><span style="text-decoration: line-through;">Create Zend_Db_Adapters support gateway</span>** Again Why? I think the performance overhead is considerable, wouldn't it be better to contribute new adapters for Doctrine then? (beberlei)</li>
</ul>

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Nov 17, 2009

    <p>I hacked in cli support this morning:
    <a class="external-link" href="http://giorgiosironi.blogspot.com/2009/11/doctrine-2-and-zend-framework.html">http://giorgiosironi.blogspot.com/2009/11/doctrine-2-and-zend-framework.html</a><br />
    I guess I can help with the Zend_Tool providers for Doctrine 2 and the application resource if you share the prototypes.</p>

  2. Jan 12, 2010

    <p>I wrote n Adapter for using an existing Zend_Cache instance including prefixing all doctrine-related stuff some time ago:</p>

    <p><a class="external-link" href="http://www.robo47.net/codeschnipsel/32-Adapter-fuer-Doctrine_Cache-zu-Zend_Cache">http://www.robo47.net/codeschnipsel/32-Adapter-fuer-Doctrine_Cache-zu-Zend_Cache</a></p>
    <ac:macro ac:name="code"><ac:plain-text-body><![CDATA[
    <?php

    /**

    • An Adapter for using a Zend_Cache_Core-Instance as Query or Result-Cache
    • for Doctrine
      *
    • Offers an additional Prefix for its entries for usage within prefix-based
    • Cache-Structure (for example when using one Zend_Cache_Core for a complete
    • system)
      *
    • @uses Doctrine_Cache_Interface
    • @author Benjamin Steininger
    • @license New BSD License
    • @category Robo47
    • @package Robo47_Cache
    • @todo Add support for Tags to automatically tag all Entry made with a
    • set of Tags provided by the constructor
      */
      class Robo47_Cache_DoctrineAdapter implements Doctrine_Cache_Interface
      {
      /**
    • @var Zend_Cache_Core
      */
      protected $_cache = null;

    /**

    • @param string
      */
      protected $_prefix = '';

    /**

    • @param Zend_Cache_Core $cache
    • @param string $prefix
      */
      public function __construct(Zend_Cache_Core $cache, $prefix = '')
      Unknown macro: { $this->_cache = $cache; $this->_prefix = $prefix; }

    /**

    • Test if a cache is available for the given id and (if yes) return it
    • (false else)
      *
    • Note : return value is always "string" (unserialization is done by the
    • core not by the backend)
      *
    • @param string $id cache id
    • @param boolean $testCacheValidity if set to false, the cache
    • validity won't be tested
    • @return string cached datas (or false)
      */
      public function fetch($id, $testCacheValidity = true)
      Unknown macro: { $id = $this->_prefix . $id; return $this->_cache->load($id, $testCacheValidity); }

    /**

    • Test if a cache is available or not (for the given id)
      *
    • @param string $id cache id
    • @return mixed false (a cache is not available) or "last modified"
    • timestamp (int) of the available cache record
      */
      public function contains($id)
      Unknown macro: { $id = $this->_prefix . $id; return $this->_cache->test($id); }

    /**

    • Save some string datas into a cache record
      *
    • Note : $data is always saved as a string
      *
    • @param string $id cache id
    • @param string $data data to cache
    • @param int $lifeTime if != false, set a specific
    • lifetime for this cache record
    • (null => infinite lifeTime)
    • @return boolean true if no problem
      */
      public function save($id, $data, $lifeTime = false)
      Unknown macro: { $id = $this->_prefix . $id; return $this->_cache->save($data, $id, array(), $lifeTime); }

    /**

    • Remove a cache record
      *
    • @param string $id cache id
    • @return boolean true if no problem
      */
      public function delete($id)
      Unknown macro: { $id = $this->_prefix . $id; return $this->_cache->remove($id); }

      }
      ]]></ac:plain-text-body></ac:macro>
      <p><br class="atl-forced-newline" /></p>

    <p>Could be extended with support for default-tags which are added to each entry, so finding out all doctrine-related cache-entries would be a lot easier.<br />
    If interessted i can extend my version and write some unittests for it.</p>

    1. Jan 25, 2010

      <p>I definitely think it's worth creating a proposal for.</p>

  3. Feb 28, 2010

    <p>I like it and hope this won't take too long to get it going.</p>

    <p>I just don't like the require calls, as the guideline now is to use autoloading.</p>