Skip to content

Commit 963f6ab

Browse files
committed
autoload mode switcher added
1 parent ec389c2 commit 963f6ab

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

src/AbraFlexi/RO.php

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,12 +357,18 @@ class RO extends \Ease\Sand {
357357

358358
/**
359359
* Formating string for \DateTime::format() for datetime columns
360+
*
361+
* @deprecated since version 2.17
362+
*
360363
* @var string
361364
*/
362365
static public $DateTimeFormat = 'Y-m-d\TH:i:s.u+P';
363366

364367
/**
365368
* Formating string for \DateTime::format() for date columns
369+
*
370+
* @deprecated since version 2.17
371+
*
366372
* @var string
367373
*/
368374
static public $DateFormat = 'Y-m-d';
@@ -379,6 +385,13 @@ class RO extends \Ease\Sand {
379385
*/
380386
public $chained = [];
381387

388+
/**
389+
* Load whole record when id is given ?
390+
*
391+
* @var boolean
392+
*/
393+
public $autoload = true;
394+
382395
/**
383396
* We Connect to server by default
384397
* @var boolean
@@ -443,7 +456,7 @@ public function setObjectName($objectName = null) {
443456
*
444457
* @param array $options Object Options ( user,password,authSessionId
445458
* company,url,evidence,
446-
* prefix,defaultUrlParams,debug,
459+
* prefix,defaultUrlParams,debug,autoload
447460
* detail,offline,filter,ignore404,nativeTypes
448461
* timeout,companyUrl,ver,throwException
449462
*/
@@ -489,6 +502,7 @@ public function setUp(array $options = []) {
489502

490503
$this->setupProperty($options, 'throwException', 'ABRAFLEXI_EXCEPTIONS');
491504
$this->setupProperty($options, 'debug');
505+
$this->setupProperty($options, 'autoload');
492506
$this->updateApiURL();
493507
}
494508

@@ -607,14 +621,18 @@ public function curlInit() {
607621
* @param mixed $init číslo/"(code:)kód"/(část)URI záznamu k načtení | pole hodnot k předvyplnění
608622
*/
609623
public function processInit($init) {
610-
if (is_integer($init)) {
624+
if (is_integer($init) && $this->autoload) {
611625
$this->loadFromAbraFlexi($init);
612626
} elseif (is_array($init)) {
613627
$this->takeData($init);
614628
} elseif (!is_object($init) && preg_match('/\.(json|xml|csv)/', $init)) {
615629
$this->takeData($this->getFlexiData((($init[0] != '/') ? $this->evidenceUrlWithSuffix($init) : $init)));
616630
} else {
617-
$this->loadFromAbraFlexi($init);
631+
if($this->autoload === false){
632+
$this->setMyKey($init);
633+
} else {
634+
$this->loadFromAbraFlexi($init);
635+
}
618636
}
619637
}
620638

0 commit comments

Comments
 (0)