osdir.com
mailing list archive

Subject: RE: post-insert logic - msg#00081

List: php.zend.framework.db

Date: Prev Next Index Thread: Prev Next Index
Yes, check out the method Zend_Db_Table_Row_Abstract::_postInsert().   Before the Row class calls _postInsert(), $this->_data array has been populated with the primary key value.   So you need to override _postInsert() in your subclass of Row, and examine $this->_data.   Regards, Bill Karwin
From: Jeff Bailey [mailto:jbailey-FnsA7b+Nu9UIryFE1BWNpEEOCMrvLtNR@xxxxxxxxxxxxxxxx]
Sent: Thursday, May 24, 2007 8:38 PM
To: fw-db-wwOhfgvld6hpLGFMi4vTTA@xxxxxxxxxxxxxxxx
Subject: [fw-db] post-insert logic

I don't see it in the code, but is there a way to do post-insert logic?  I would like to make sure that I always send an email out when a group is created, no matter how I inserted the record, so I put the function in _insert.  However, the URL uses the group_id, which is the primary key, so isn't available at this point.

--
Jeff Bailey - http://www.raspberryginger.com/jbailey/
Was this page helpful?
Yes No
Thread at a glance:

Previous Message by Date: click to view message preview

Post-insert

Sorry, I'm tired and didn't include enough info.  I'm subclassing Zend_Db_Table_Row_Abstract.-- Jeff Bailey - http://www.raspberryginger.com/jbailey/

Next Message by Date: click to view message preview

access tablename.colname -> access error (of join $ select)

Hi, i have a select that joins tables. the new col names now are tablename.originalcolname. usually i access cols via: echo $row->colname; but echo $row->tablename.originalcolname; wont work. I tried renaming them in the SELECT using AS (tablename.originalcolname AS colname). Zend doesnt recognize the new colname. I have attached the print_r of the rowset. thank you Bastian Zend_Db_Table_Rowset Object ( [_data:protected] => Array ( [0] => Array ( ["vuebersicht"."id"] => 1 ["vuebersicht"."name"] => Die Reise zum Krafttier und innerem Lehrer ["vuebersicht"."dozent"] => Andreas Koell ["vuebersicht"."veranstaltungstyp"] => Vortrag ) [1] => Array ( ["vuebersicht"."id"] => 2 ["vuebersicht"."name"] => Schnitzeljagt ["vuebersicht"."dozent"] => Andreas Koell ["vuebersicht"."veranstaltungstyp"] => Ausbildung ) [2] => Array ( ["vuebersicht"."id"] => 3 ["vuebersicht"."name"] => Peter 3000 ["vuebersicht"."dozent"] => Andreas Koell ["vuebersicht"."veranstaltungstyp"] => Vortrag ) ) [_table:protected] => Vuebersicht Object ( [_name:protected] => vuebersicht [_db:protected] => Zend_Db_Adapter_Pdo_Sqlite Object ( [_pdoType:protected] => sqlite [_config:protected] => Array ( [username] => [password] => [dbname] => energieheilkunde.s3db ) [_fetchMode:protected] => 2 [_profiler:protected] => Zend_Db_Profiler Object ( [_queryProfiles:protected] => Array ( ) [_enabled:protected] => [_filterElapsedSecs:protected] => [_filterTypes:protected] => ) [_connection:protected] => PDO Object ( ) ) [_schema:protected] => [_cols:protected] => Array ( [0] => id [1] => name [2] => dozent [3] => veranstaltungstyp ) [_primary:protected] => [_sequence:protected] => 1 [_metadata:protected] => Array ( [id] => Array ( [SCHEMA_NAME] => [TABLE_NAME] => vuebersicht [COLUMN_NAME] => id [COLUMN_POSITION] => 1 [DATA_TYPE] => INTEGER [DEFAULT] => [NULLABLE] => 1 [LENGTH] => [SCALE] => [PRECISION] => [UNSIGNED] => [PRIMARY] => [PRIMARY_POSITION] => 0 ) [name] => Array ( [SCHEMA_NAME] => [TABLE_NAME] => vuebersicht [COLUMN_NAME] => name [COLUMN_POSITION] => 2 [DATA_TYPE] => VarCHAR(250) [DEFAULT] => [NULLABLE] => 1 [LENGTH] => [SCALE] => [PRECISION] => [UNSIGNED] => [PRIMARY] => [PRIMARY_POSITION] => 0 ) [dozent] => Array ( [SCHEMA_NAME] => [TABLE_NAME] => vuebersicht [COLUMN_NAME] => dozent [COLUMN_POSITION] => 3 [DATA_TYPE] => VARCHAR(250) [DEFAULT] => [NULLABLE] => 1 [LENGTH] => [SCALE] => [PRECISION] => [UNSIGNED] => [PRIMARY] => [PRIMARY_POSITION] => 0 ) [veranstaltungstyp] => Array ( [SCHEMA_NAME] => [TABLE_NAME] => vuebersicht [COLUMN_NAME] => veranstaltungstyp [COLUMN_POSITION] => 4 [DATA_TYPE] => varchar(250) [DEFAULT] => [NULLABLE] => 1 [LENGTH] => [SCALE] => [PRECISION] => [UNSIGNED] => [PRIMARY] => [PRIMARY_POSITION] => 0 ) ) [_metadataCache:protected] => [_rowClass:protected] => Zend_Db_Table_Row [_rowsetClass:protected] => Zend_Db_Table_Rowset [_referenceMap:protected] => Array ( ) [_dependentTables:protected] => Array ( ) ) [_connected:protected] => 1 [_tableClass:protected] => Vuebersicht [_rowClass:protected] => Zend_Db_Table_Row [_pointer:protected] => 0 [_count:protected] => 3 [_rows:protected] => Array ( ) [_stored:protected] => 1 ) -- View this message in context: http://www.nabble.com/access-tablename.colname--%3E-access-error-%28of-join-%24-select%29-tf3816051s16154.html#a10802726 Sent from the Zend DB mailing list archive at Nabble.com.

Previous Message by Thread: click to view message preview

post-insert logic

I don't see it in the code, but is there a way to do post-insert logic?  I would like to make sure that I always send an email out when a group is created, no matter how I inserted the record, so I put the function in _insert.  However, the URL uses the group_id, which is the primary key, so isn't available at this point. -- Jeff Bailey - http://www.raspberryginger.com/jbailey/

Next Message by Thread: click to view message preview

Re: post-insert logic

Doh, thanks!  I hadn't updated to 0.9.3 yet.  My bad.On 24/05/07, Bill Karwin <bill.k-C1q0ot2/XZ0@xxxxxxxxxxxxxxxx> wrote: Yes, check out the method Zend_Db_Table_Row_Abstract::_postInsert().   Before the Row class calls _postInsert(), $this->_data array has been populated with the primary key value.   So you need to override _postInsert() in your subclass of Row, and examine $this->_data.   Regards, Bill Karwin From: Jeff Bailey [mailto:jbailey-FnsA7b+Nu9UIryFE1BWNpEEOCMrvLtNR@xxxxxxxxxxxxxxxx] Sent: Thursday, May 24, 2007 8:38 PMTo: fw-db-wwOhfgvld6hpLGFMi4vTTA@xxxxxxxxxxxxxxxxSubject: [fw-db] post-insert logic I don't see it in the code, but is there a way to do post-insert logic?  I would like to make sure that I always send an email out when a group is created, no matter how I inserted the record, so I put the function in _insert.  However, the URL uses the group_id, which is the primary key, so isn't available at this point. -- Jeff Bailey - http://www.raspberryginger.com/jbailey/ -- Jeff Bailey - http://www.raspberryginger.com/jbailey/
Sign up for updates to this mailing list. email:
Loading Comments...
Home | News | Patents | Sitemap | FAQ | advertise

Advertising by