From 62f72a7014ca8c0ec910b73d188a2498e47fc43a Mon Sep 17 00:00:00 2001 From: zYne Date: Thu, 14 Jun 2007 20:37:11 +0000 Subject: [PATCH] --- lib/Doctrine/Relation.php | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/lib/Doctrine/Relation.php b/lib/Doctrine/Relation.php index 4e756d6ce..b24832ad0 100644 --- a/lib/Doctrine/Relation.php +++ b/lib/Doctrine/Relation.php @@ -67,6 +67,7 @@ abstract class Doctrine_Relation 'onDelete' => false, 'onUpdate' => false, 'deferred' => false, + 'deferrable' => false, 'constraint' => false, 'equal' => false, ); @@ -94,7 +95,7 @@ abstract class Doctrine_Relation * * type the relation type, either Doctrine_Relation::ONE or Doctrine_Relation::MANY * - * constraint boolean value, true if the relation needs referential integrity constraint + * constraint boolean value, true if the relation has an explicit referential integrity constraint * * The onDelete and onUpdate keys accept the following values: * @@ -131,10 +132,30 @@ abstract class Doctrine_Relation $this->definition = $def; } - + /** + * hasConstraint + * whether or not this relation has an explicit constraint + * + * @return boolean + */ + public function hasConstraint() + { + return ($this->definition['constraint'] || + ($this->definition['onUpdate']) || + ($this->definition['onDelete'])); + } + public function isDeferred() + { + return $this->definition['deferred']; + } + + public function isDeferrable() + { + return $this->definition['deferrable']; + } public function isEqual() { - return $this->definition['equal']; + return $this->definition['equal']; } /** * toArray @@ -145,15 +166,6 @@ abstract class Doctrine_Relation { return $this->definition; } - /** - * hasConstraint - * - * @return boolean - */ - public function hasConstraint() - { - return $this->definition['constraint']; - } /** * getAlias * returns the relation alias