Skip to content

Commit

Permalink
Fix typo at ORM config
Browse files Browse the repository at this point in the history
  • Loading branch information
k-samuel committed Jul 18, 2016
1 parent feadd04 commit a51b450
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 24 deletions.
6 changes: 3 additions & 3 deletions data/docs/sysdocs_class_method.csv
Original file line number Diff line number Diff line change
Expand Up @@ -7763,7 +7763,7 @@ array(
...
'objectNameN'=>array(id1,id2,id3),
),
'multy' =>array(
'multi' =>array(
'objectName'=>array(id1,id2,id3),
...
'objectNameN'=>array(id1,id2,id3),
Expand All @@ -7773,11 +7773,11 @@ array(
when object has link as own property
array(
'field1'=>'object',
'field2'=>'multy'
'field2'=>'multi'
...
'fieldN'=>'object',
)";;"eaa67b44149a6a4600de73c0d66ff1fe";"0";"1";"protected";"8";"array";"bc383e00c52f6df1e74342c2bcd2ed33";"0";"0";"0";"54505"
"4353";"_getMultyLinks";"0";"Get multylink associations
"4353";"_getMultiLinks";"0";"Get multi-link associations
when links storedin external objects";;"ec974e682911929480d53cdbef73cd27";"0";"1";"protected";"8";"array";"bc383e00c52f6df1e74342c2bcd2ed33";"0";"0";"0";"54506"
"4353";"getAssociatedStructures";"0";"Check if Object has associated objects";;"37165c822a5be6d8a839c11fe55732b5";"0";"1";"public";"8";"array - associations";"bc383e00c52f6df1e74342c2bcd2ed33";"0";"0";"0";"54507"
"4354";"__construct";"0";;;"03798abc6649371c95c6ce585a7e673b";"0";"0";"public";"8";;"be437dbe66cb08cbfe3b6d561c66aca9";"0";"0";"0";"54508"
Expand Down
2 changes: 1 addition & 1 deletion data/docs/sysdocs_class_method_param.csv
Original file line number Diff line number Diff line change
Expand Up @@ -4770,7 +4770,7 @@
"54589";"14a1c033ebc723606a3026982c3f78d6";"field";"8";"0";NULL;"0";"string";"9c9fa3745c7a37c6534b8d7a0ace9dee";"0";"41937"
"54590";"b8d936050360b95de4195d5f8020699b";"linkTypes";"8";"0";"array (
0 => 'object',
1 => 'multy',
1 => 'multi',
)";"0";;"277ee6369a6b17bd007a2a747626d263";"1";"41938"
"54590";"77f3badccff50d420315a5da5969af53";"groupByObject";"8";"1";"true";"0";"boolean - group field by linked object, default true";"277ee6369a6b17bd007a2a747626d263";"1";"41939"
"54591";"12468aa80fbf8df37236830b0646a2a6";"name";"8";"0";NULL;"0";"string";"767d67ec0f7d4b0b33ffb4393d6408ad";"0";"41940"
Expand Down
2 changes: 1 addition & 1 deletion data/docs/sysdocs_class_property.csv
Original file line number Diff line number Diff line change
Expand Up @@ -18389,7 +18389,7 @@ Properties data
"0";"e5ae0deef86851aa49ed99acebdb8ff3";"8";"_errors";;"0";"0";"protected";;"4357";NULL;"810f3b81d042bc943d87c70f2efc58c9";"0";"130028"
"0";"d54bfac3d46ba37e86438056973ec461";"8";"_objects";;"0";"1";"protected";;"4358";NULL;"1f42f326ea14599aa2c77dbd52340342";"0";"130029"
"0";"0dcab0d305b18b1693ac23c93dd32455";"8";"LINK_OBJECT";;"1";"0";"public";;"4359";"object";"44ee788fdef812dab4ff7ea4cc4623bc";"0";"130030"
"0";"f7213b45c87e57bb51d9e3e3959db118";"8";"LINK_OBJECT_LIST";;"1";"0";"public";;"4359";"multy";"44ee788fdef812dab4ff7ea4cc4623bc";"0";"130031"
"0";"f7213b45c87e57bb51d9e3e3959db118";"8";"LINK_OBJECT_LIST";;"1";"0";"public";;"4359";"multi";"44ee788fdef812dab4ff7ea4cc4623bc";"0";"130031"
"0";"36c77cb39c81989c52226c11f0ae0745";"8";"LINK_DICTIONARY";;"1";"0";"public";;"4359";"dictionary";"44ee788fdef812dab4ff7ea4cc4623bc";"0";"130032"
"0";"3464fdbad2ea6a4aca8a3745f64019c9";"8";"DEFAULT_CONNECTION";;"1";"0";"public";;"4359";"default";"44ee788fdef812dab4ff7ea4cc4623bc";"0";"130033"
"0";"d61b7eb501bfc8676e8b108604ff029a";"8";"RELATION_MANY_TO_MANY";;"1";"0";"public";;"4359";"many_to_many";"44ee788fdef812dab4ff7ea4cc4623bc";"0";"130034"
Expand Down
4 changes: 2 additions & 2 deletions dvelum/library/Db/Object.php
Original file line number Diff line number Diff line change
Expand Up @@ -335,11 +335,11 @@ protected function _validateLink($name , $value)
switch ($propConf['link_config']['link_type'])
{
case 'object':
case 'multy':
case 'multi' :
return self::objectExists($propConf['link_config']['object'], $value);
break;
case 'dictionary':
$dictionary = Dictionary::getInstance($propConf['link_config']['object']);
$dictionary = Dictionary::factory($propConf['link_config']['object']);
return $dictionary->isValidKey($value);
break;
}
Expand Down
8 changes: 7 additions & 1 deletion dvelum/library/Db/Object/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
class Db_Object_Config
{
const LINK_OBJECT = 'object';
const LINK_OBJECT_LIST = 'multy';
const LINK_OBJECT_LIST = 'multi';
const LINK_DICTIONARY = 'dictionary';
const DEFAULT_CONNECTION = 'default';
const RELATION_MANY_TO_MANY = 'many_to_many';
Expand Down Expand Up @@ -266,6 +266,12 @@ protected function _loadProperties()
if(!isset($dataLink['slave_connection']) || empty($dataLink['slave_connection']))
$dataLink['slave_connection'] = $dataLink['connection'];

foreach($dataLink['fields'] as &$field){
if(isset($field['link_config']) && isset($field['link_config']['link_type']) && $field['link_config']['link_type'] == 'multy'){
$field['link_config']['link_type'] = 'multi';
}
}

/*
* Load additional fields for object under revision control
*/
Expand Down
18 changes: 9 additions & 9 deletions dvelum/library/Db/Object/Expert.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static protected function _buildAssociations()
* ...
* 'objectNameN'=>array(id1,id2,id3),
* ),
* 'multy' =>array(
* 'multi' =>array(
* 'objectName'=>array(id1,id2,id3),
* ...
* 'objectNameN'=>array(id1,id2,id3),
Expand All @@ -45,7 +45,7 @@ static protected function _buildAssociations()
*/
static public function getAssociatedObjects(Db_Object $object)
{
$linkedObjects = array('single'=>array(),'multy'=>array());
$linkedObjects = array('single'=>array(),'multi'=>array());

self::_buildAssociations();

Expand All @@ -66,7 +66,7 @@ static public function getAssociatedObjects(Db_Object $object)
$linkedObjects['single'][$testObject] = $sLinks;
}

$linkedObjects['multy'] = self::_getMultyLinks($objectName, $objectId);
$linkedObjects['multi'] = self::_getMultiLinks($objectName, $objectId);

return $linkedObjects;
}
Expand All @@ -78,7 +78,7 @@ static public function getAssociatedObjects(Db_Object $object)
* @param array $links - links config like
* array(
* 'field1'=>'object',
* 'field2'=>'multy'
* 'field2'=>'multi'
* ...
* 'fieldN'=>'object',
* )
Expand Down Expand Up @@ -121,13 +121,13 @@ static protected function _getSingleLinks($objectId, $relatedObject , $links)
return Utils::fetchCol($relatedConfig->getPrimaryKey(), $data);
}
/**
* Get multylink associations
* Get multi-link associations
* when links stored in external objects
* @param string $objectName
* @param integer $objectId
* @return array
*/
static protected function _getMultyLinks($objectName , $objectId)
static protected function _getMultiLinks($objectName , $objectId)
{
$configMain = Registry::get('main', 'config');

Expand All @@ -139,12 +139,12 @@ static protected function _getMultyLinks($objectName , $objectId)
->from($linkTable, array('id'=>'src_id','object'=>'src'))
->where('`target` =?',$objectName)
->where('`target_id` =?', $objectId);
$multyLinks = $db->fetchAll($sql);
$links = $db->fetchAll($sql);

$data = array();

if(!empty($multyLinks))
foreach ($multyLinks as $record)
if(!empty($links))
foreach ($links as $record)
$data[$record['object']][] = $record['id'];

return $data;
Expand Down
2 changes: 1 addition & 1 deletion dvelum/library/Db/Query/Part.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function setObject($name)
foreach($cfgFields as $k => $v)
{
/*
* Ignore multylinks
* Ignore multi-links
*/
if($config->isMultiLink($k))
continue;
Expand Down
Loading

0 comments on commit a51b450

Please sign in to comment.