1

I was used to work with Zend Db Table Relationships with MySQL. I declared $_dependentTables and $_referenceMap in the table classes as described in the manual. Then was able to work with functions findDependentRowset(), findParentRow() etc.

Now I use PostgreSQL, which is able to define the relations (REFERENCES) between tables right in the database.

The manual states:

Skip declaration of $_dependentTables if you use referential integrity constraints in the RDBMS server to implement cascading operations

what should be the case of Postgres. Despite this, I am not able to get it working. Unless I declare the referenceMap (but this shouldn't be needed!), I am still getting error:

No reference from table ... to table ...

The question is - is it possible to use references declared in Postgres in Zend Db, without (re-)declaring them in referenceMap? How - does ZF load it from Postgres to the referenceMap? If so, why I am getting the error?

Ondrej Machulda
  • 998
  • 1
  • 12
  • 24
  • are you actually using the "referential integrity constraints" in postgre? Anyway this statement refers more to the cascading operations used with `ON UPDATE` and `ON DELETE` not the relationships themseleves. click the link in ["See this chapter for more information"](http://framework.zend.com/manual/en/zend.db.table.relationships.html#zend.db.table.relationships.cascading) Either way it's not really clear what the issues are. – RockyFord Mar 19 '12 at 22:09
  • Yes, the constrains are defined on DB level (foreign keys are specified by REFERENCES). But you may have the point that the statement only applies to cascading operations, not to the relations. Anyone can confirm that? – Ondrej Machulda Mar 20 '12 at 00:49

1 Answers1

0

My reading of the linked documentation is that these two address something different.

The DRI in the db recommendation is a recommendation to specify ON UPDATE CASCADE and ON DELETE CASCADE operations in the db rather than telling Zend to cascade.

What you are doing is something different, which is to use the referential integrity mapping to fetch related rows. In this case, it looks like Zend requires that you declare it.

Chris Travers
  • 25,424
  • 6
  • 65
  • 182