ZF-2379: Add interface to add references to the ZDT

Issue Type: Improvement Created: 2008-01-04T04:46:50.000+0000 Last Updated: 2009-01-08T07:21:47.000+0000 Status: Resolved Fix version(s): - 1.8.0 (30/Apr/09)

Reporter: Jurrien Stutterheim (norm2782) Assignee: Jurrien Stutterheim (norm2782) Tags: - Zend_Db_Table

Related issues: Attachments: - zdta.diff


The current way of adding references to a ZDTA subclass is by providing an array. This is a very verbose and non-intuitive way of setting up the relation, which forces the developer to remember array keys that are actually only interesting for the ZDTA class. I want to suggest adding a method to add a relation to the ZDT instance, which will make the process more intuitive and less error-prone.

<pre class="highlight">
     * Add a reference to the reference map
     * @param string $ruleKey
     * @param string|array $columns
     * @param string $refTableClass
     * @param string|array $refColumns
     * @param string $onDelete
     * @param string $onUpdate
     * @return Zend_Db_Table_Abstract
    public function addReference($ruleKey, $columns, $refTableClass, $refColumns, $onDelete = null, $onUpdate = null)
        $reference = array(self::COLUMNS         => $columns,
                           self::REF_TABLE_CLASS => $refTableClass,
                           self::REF_COLUMNS     => $refColumns);

        if (!empty($onDelete)) {
            $reference[self::ON_DELETE] = $onDelete;

        if (!empty($onUpdate)) {
            $reference[self::ON_UPDATE] = $onUpdate;

        $this->_referenceMap[$ruleKey] = $reference;

        return $this;


Posted by Jurrien Stutterheim (norm2782) on 2008-01-04T04:48:27.000+0000

Added diff file

Posted by Jurrien Stutterheim (norm2782) on 2008-02-14T04:44:25.000+0000

Updated code to use the class constants.

Posted by Wil Sinclair (wil) on 2008-03-25T20:43:56.000+0000

Please categorize/fix as needed.

Posted by Wil Sinclair (wil) on 2008-04-18T13:12:04.000+0000

This doesn't appear to have been fixed in 1.5.0. Please update if this is not correct.

Posted by Jurrien Stutterheim (norm2782) on 2009-01-08T07:21:46.000+0000

Resolved in r. 13553

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.