-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathskip-validation-of-relation-identifier.patch
More file actions
49 lines (46 loc) · 1.42 KB
/
skip-validation-of-relation-identifier.patch
File metadata and controls
49 lines (46 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
Index: Doctrine/lib/Doctrine/Table.php
===================================================================
--- Doctrine.orig/lib/Doctrine/Table.php 2011-03-21 16:08:54.216144000 +0200
+++ Doctrine/lib/Doctrine/Table.php 2011-03-21 16:09:26.186144001 +0200
@@ -227,6 +227,8 @@
*/
protected $record;
+ protected $_relationIdentifiers;
+
/**
* the constructor
*
@@ -1011,6 +1013,21 @@
return $this->_parser->getRelations();
}
+ public function getRelationIdentifiers()
+ {
+ if (isset($this->_relationIdentifiers))
+ {
+ return $this->_relationIdentifiers;
+ }
+
+ $this->_relationIdentifiers = array();
+ foreach($this->getRelations() as $relation)
+ {
+ $this->_relationIdentifiers[$relation->getLocalFieldName()] = $relation->getAlias();
+ }
+ return $this->_relationIdentifiers;
+ }
+
/**
* Creates a query on this table.
*
@@ -2048,6 +2065,13 @@
return $errorStack;
}
}
+ } else if (array_key_exists($fieldName, $this->getRelationIdentifiers()) && $record !== null) {
+ $r = $this->_relationIdentifiers[$fieldName];
+ // Related record is not saved yet
+ if (!$record->$r->exists())
+ {
+ return $errorStack;
+ }
}
$dataType = $this->getTypeOf($fieldName);