ZF-2666: Add isIdentity() method

Issue Type: New Feature Created: 2008-02-16T04:33:54.000+0000 Last Updated: 2009-01-08T07:32:41.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:


On a few occasions I had to check if a column was the primary key (with auto-increment) in a table. One of these occasions was when I wanted to automate the creating/updating of a row after a form has been submitted and validated. The identity column needed to be ignored, because a value shouldn't be explicitly set. I ended up writing the following method in a custom Zend_Db_Table class:

<pre class="highlight">
public function isIdentity($column)
    if (!isset($this->_metadata[$column])) {
        return false;

    return (bool) $this->_metadata[$column]['IDENTITY'];

I'd like to see this method added to Zend_Db_Table_Abstract if possible for 1.5 :)


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

Please categorize/fix as needed.

Posted by Wil Sinclair (wil) on 2008-04-18T13:11:52.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 2008-04-25T14:22:29.000+0000

It seems that in general ZDTA likes to throw exceptions when a non-existing column is specified. In my own SVN I changed the return false to throw an exception.

Posted by Jurrien Stutterheim (norm2782) on 2008-11-08T06:15:44.000+0000

Fixed in revision 12428 and 12429 for bughuntday

Posted by Wil Sinclair (wil) on 2008-11-13T14:10:31.000+0000

Changing issues in preparation for the 1.7.0 release.

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

Fix from bughuntday wasn't merged with trunk.

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

Resolved in r.13554

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.