Skip to content

Commit

Permalink
Fixed the js call in the paginator.
Browse files Browse the repository at this point in the history
  • Loading branch information
feuzeu committed May 19, 2024
1 parent 2831761 commit 01c17e2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
38 changes: 19 additions & 19 deletions src/Js/Call.php
Original file line number Diff line number Diff line change
Expand Up @@ -430,49 +430,49 @@ public function setPageNumber(int $nPageNumber): Call
}

/**
* Convert this call to array
* Convert the first call to array
*
* @return array
*/
public function toArray(): array
{
$aCalls = [[
return [
'_type' => 'func',
'_name' => $this->sFunction,
'args' => array_map(function(JsonSerializable $xParam) {
return $xParam->jsonSerialize();
}, $this->aParameters),
]];
];
}

/**
* Convert this call to array, when converting the response into json.
*
* @return array
*/
public function jsonSerialize(): array
{
$aCalls = [$this->toArray()];
if($this->bToInt)
{
$aCalls[] = $this->toIntCall();
}

$aCall = ['_type' => 'expr', 'calls' => $aCalls];
$aExpr = ['_type' => 'expr', 'calls' => $aCalls];
if(($this->aConfirm))
{
$aCall['question'] = $this->aConfirm;
$aExpr['question'] = $this->aConfirm;
}
if(($this->aCondition))
{
$aCall['condition'] = $this->aCondition;
$aExpr['condition'] = $this->aCondition;
}
if(($this->aMessage))
{
$aCall['message'] = $this->aMessage;
$aExpr['message'] = $this->aMessage;
}

return $aCall;
}

/**
* Convert this call to array, when converting the response into json.
*
* @return array
*/
public function jsonSerialize(): array
{
return $this->toArray();
return $aExpr;
}

/**
Expand All @@ -482,7 +482,7 @@ public function jsonSerialize(): array
*/
public function __toString(): string
{
return 'jaxon.exec(' . json_encode($this->toArray()) . ')';
return 'jaxon.exec(' . json_encode($this->jsonSerialize()) . ')';
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Js/Parameter.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public function jsonSerialize()
switch($this->getType())
{
case self::JS_CALL:
return $this->getValue()->toArray();
return $this->getValue()->jsonSerialize();
case self::JS_VALUE:
return [
'_type' => 'expr',
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin/Code/AssetManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class AssetManager
*
* @var string
*/
const JS_LIB_URL = 'https://cdn.jsdelivr.net/gh/jaxon-php/jaxon-js@5.0.0rc-6/dist';
const JS_LIB_URL = 'https://cdn.jsdelivr.net/gh/jaxon-php/jaxon-js@5.0.0rc-7/dist';

/**
* The constructor
Expand Down

0 comments on commit 01c17e2

Please sign in to comment.