Call a function inside a if condition
Hi guys i am trying to move my if condition code inside another new function and i would like to call that in my another function how can i do that
Here is my if condition :
if (self::GRID_LIST_STATUS_AGENDA === $gridType)
// Personal agenda sortation of statuses
unset($finalFilters['statusId']['distinct']);
$finalFilters['statusId']['values'] = [
BAS_Shared_Model_Ticket::STATUS_REPLY_RELATION => 'relation reply',
BAS_Shared_Model_Ticket::STATUS_REMINDER => 'followup',
BAS_Shared_Model_Ticket::STATUS_NEW => 'new',
BAS_Shared_Model_Ticket::STATUS_IN_PROGRESS => 'in progress',
BAS_Shared_Model_Ticket::STATUS_REOPEN => 'reopened',
];
Here is the new function that i want to move
/**
* Get personal agenda sortation statuses
*/
public function personalAgendaSortationStatuses()
Can anyone help me how can i do that
php zend-framework
|
show 3 more comments
Hi guys i am trying to move my if condition code inside another new function and i would like to call that in my another function how can i do that
Here is my if condition :
if (self::GRID_LIST_STATUS_AGENDA === $gridType)
// Personal agenda sortation of statuses
unset($finalFilters['statusId']['distinct']);
$finalFilters['statusId']['values'] = [
BAS_Shared_Model_Ticket::STATUS_REPLY_RELATION => 'relation reply',
BAS_Shared_Model_Ticket::STATUS_REMINDER => 'followup',
BAS_Shared_Model_Ticket::STATUS_NEW => 'new',
BAS_Shared_Model_Ticket::STATUS_IN_PROGRESS => 'in progress',
BAS_Shared_Model_Ticket::STATUS_REOPEN => 'reopened',
];
Here is the new function that i want to move
/**
* Get personal agenda sortation statuses
*/
public function personalAgendaSortationStatuses()
Can anyone help me how can i do that
php zend-framework
1
yes its working..thank you thanks a lot
– suresh
Nov 13 '18 at 7:28
from the first function you returned some data to second function and now it's up-to-you that what you want to do with that data. if you want to return then use return , if you want to print print there. completely your choice as well as depended on what the second function intended to do.
– Alive to Die
Nov 13 '18 at 7:35
i have already used return $finalFilters; in my old function now we have used same in our current function so can i remove that in my old fucntion? it wont make any problem to my old fucntion rite?
– suresh
Nov 13 '18 at 7:35
1
one function cannot have 2 returns. you can use array to return multiple data at a time from one function
– Alive to Die
Nov 13 '18 at 7:40
1
okay sure..thank you for your help
– suresh
Nov 13 '18 at 7:52
|
show 3 more comments
Hi guys i am trying to move my if condition code inside another new function and i would like to call that in my another function how can i do that
Here is my if condition :
if (self::GRID_LIST_STATUS_AGENDA === $gridType)
// Personal agenda sortation of statuses
unset($finalFilters['statusId']['distinct']);
$finalFilters['statusId']['values'] = [
BAS_Shared_Model_Ticket::STATUS_REPLY_RELATION => 'relation reply',
BAS_Shared_Model_Ticket::STATUS_REMINDER => 'followup',
BAS_Shared_Model_Ticket::STATUS_NEW => 'new',
BAS_Shared_Model_Ticket::STATUS_IN_PROGRESS => 'in progress',
BAS_Shared_Model_Ticket::STATUS_REOPEN => 'reopened',
];
Here is the new function that i want to move
/**
* Get personal agenda sortation statuses
*/
public function personalAgendaSortationStatuses()
Can anyone help me how can i do that
php zend-framework
Hi guys i am trying to move my if condition code inside another new function and i would like to call that in my another function how can i do that
Here is my if condition :
if (self::GRID_LIST_STATUS_AGENDA === $gridType)
// Personal agenda sortation of statuses
unset($finalFilters['statusId']['distinct']);
$finalFilters['statusId']['values'] = [
BAS_Shared_Model_Ticket::STATUS_REPLY_RELATION => 'relation reply',
BAS_Shared_Model_Ticket::STATUS_REMINDER => 'followup',
BAS_Shared_Model_Ticket::STATUS_NEW => 'new',
BAS_Shared_Model_Ticket::STATUS_IN_PROGRESS => 'in progress',
BAS_Shared_Model_Ticket::STATUS_REOPEN => 'reopened',
];
Here is the new function that i want to move
/**
* Get personal agenda sortation statuses
*/
public function personalAgendaSortationStatuses()
Can anyone help me how can i do that
php zend-framework
php zend-framework
edited Nov 13 '18 at 7:35
line88
622315
622315
asked Nov 13 '18 at 7:16
sureshsuresh
29410
29410
1
yes its working..thank you thanks a lot
– suresh
Nov 13 '18 at 7:28
from the first function you returned some data to second function and now it's up-to-you that what you want to do with that data. if you want to return then use return , if you want to print print there. completely your choice as well as depended on what the second function intended to do.
– Alive to Die
Nov 13 '18 at 7:35
i have already used return $finalFilters; in my old function now we have used same in our current function so can i remove that in my old fucntion? it wont make any problem to my old fucntion rite?
– suresh
Nov 13 '18 at 7:35
1
one function cannot have 2 returns. you can use array to return multiple data at a time from one function
– Alive to Die
Nov 13 '18 at 7:40
1
okay sure..thank you for your help
– suresh
Nov 13 '18 at 7:52
|
show 3 more comments
1
yes its working..thank you thanks a lot
– suresh
Nov 13 '18 at 7:28
from the first function you returned some data to second function and now it's up-to-you that what you want to do with that data. if you want to return then use return , if you want to print print there. completely your choice as well as depended on what the second function intended to do.
– Alive to Die
Nov 13 '18 at 7:35
i have already used return $finalFilters; in my old function now we have used same in our current function so can i remove that in my old fucntion? it wont make any problem to my old fucntion rite?
– suresh
Nov 13 '18 at 7:35
1
one function cannot have 2 returns. you can use array to return multiple data at a time from one function
– Alive to Die
Nov 13 '18 at 7:40
1
okay sure..thank you for your help
– suresh
Nov 13 '18 at 7:52
1
1
yes its working..thank you thanks a lot
– suresh
Nov 13 '18 at 7:28
yes its working..thank you thanks a lot
– suresh
Nov 13 '18 at 7:28
from the first function you returned some data to second function and now it's up-to-you that what you want to do with that data. if you want to return then use return , if you want to print print there. completely your choice as well as depended on what the second function intended to do.
– Alive to Die
Nov 13 '18 at 7:35
from the first function you returned some data to second function and now it's up-to-you that what you want to do with that data. if you want to return then use return , if you want to print print there. completely your choice as well as depended on what the second function intended to do.
– Alive to Die
Nov 13 '18 at 7:35
i have already used return $finalFilters; in my old function now we have used same in our current function so can i remove that in my old fucntion? it wont make any problem to my old fucntion rite?
– suresh
Nov 13 '18 at 7:35
i have already used return $finalFilters; in my old function now we have used same in our current function so can i remove that in my old fucntion? it wont make any problem to my old fucntion rite?
– suresh
Nov 13 '18 at 7:35
1
1
one function cannot have 2 returns. you can use array to return multiple data at a time from one function
– Alive to Die
Nov 13 '18 at 7:40
one function cannot have 2 returns. you can use array to return multiple data at a time from one function
– Alive to Die
Nov 13 '18 at 7:40
1
1
okay sure..thank you for your help
– suresh
Nov 13 '18 at 7:52
okay sure..thank you for your help
– suresh
Nov 13 '18 at 7:52
|
show 3 more comments
1 Answer
1
active
oldest
votes
You need to change function code like below:-
public function personalAgendaSortationStatuses($gridType,$finalFilters) //pass parameter
if (self::GRID_LIST_STATUS_AGENDA === $gridType)
// Personal agenda sortation of statuses
unset($finalFilters['statusId']['distinct']);
$finalFilters['statusId']['values'] = [
BAS_Shared_Model_Ticket::STATUS_REPLY_RELATION => 'relation reply',
BAS_Shared_Model_Ticket::STATUS_REMINDER => 'followup',
BAS_Shared_Model_Ticket::STATUS_NEW => 'new',
BAS_Shared_Model_Ticket::STATUS_IN_PROGRESS => 'in progress',
BAS_Shared_Model_Ticket::STATUS_REOPEN => 'reopened',
];
return $finalFilters;
And call it in another function like this:-
$statuses = $this->personalAgendaSortationStatuses(self::GRID_LIST_STATUS_AGENDA,$finalFilters);//send second parameter too
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53275731%2fcall-a-function-inside-a-if-condition%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You need to change function code like below:-
public function personalAgendaSortationStatuses($gridType,$finalFilters) //pass parameter
if (self::GRID_LIST_STATUS_AGENDA === $gridType)
// Personal agenda sortation of statuses
unset($finalFilters['statusId']['distinct']);
$finalFilters['statusId']['values'] = [
BAS_Shared_Model_Ticket::STATUS_REPLY_RELATION => 'relation reply',
BAS_Shared_Model_Ticket::STATUS_REMINDER => 'followup',
BAS_Shared_Model_Ticket::STATUS_NEW => 'new',
BAS_Shared_Model_Ticket::STATUS_IN_PROGRESS => 'in progress',
BAS_Shared_Model_Ticket::STATUS_REOPEN => 'reopened',
];
return $finalFilters;
And call it in another function like this:-
$statuses = $this->personalAgendaSortationStatuses(self::GRID_LIST_STATUS_AGENDA,$finalFilters);//send second parameter too
add a comment |
You need to change function code like below:-
public function personalAgendaSortationStatuses($gridType,$finalFilters) //pass parameter
if (self::GRID_LIST_STATUS_AGENDA === $gridType)
// Personal agenda sortation of statuses
unset($finalFilters['statusId']['distinct']);
$finalFilters['statusId']['values'] = [
BAS_Shared_Model_Ticket::STATUS_REPLY_RELATION => 'relation reply',
BAS_Shared_Model_Ticket::STATUS_REMINDER => 'followup',
BAS_Shared_Model_Ticket::STATUS_NEW => 'new',
BAS_Shared_Model_Ticket::STATUS_IN_PROGRESS => 'in progress',
BAS_Shared_Model_Ticket::STATUS_REOPEN => 'reopened',
];
return $finalFilters;
And call it in another function like this:-
$statuses = $this->personalAgendaSortationStatuses(self::GRID_LIST_STATUS_AGENDA,$finalFilters);//send second parameter too
add a comment |
You need to change function code like below:-
public function personalAgendaSortationStatuses($gridType,$finalFilters) //pass parameter
if (self::GRID_LIST_STATUS_AGENDA === $gridType)
// Personal agenda sortation of statuses
unset($finalFilters['statusId']['distinct']);
$finalFilters['statusId']['values'] = [
BAS_Shared_Model_Ticket::STATUS_REPLY_RELATION => 'relation reply',
BAS_Shared_Model_Ticket::STATUS_REMINDER => 'followup',
BAS_Shared_Model_Ticket::STATUS_NEW => 'new',
BAS_Shared_Model_Ticket::STATUS_IN_PROGRESS => 'in progress',
BAS_Shared_Model_Ticket::STATUS_REOPEN => 'reopened',
];
return $finalFilters;
And call it in another function like this:-
$statuses = $this->personalAgendaSortationStatuses(self::GRID_LIST_STATUS_AGENDA,$finalFilters);//send second parameter too
You need to change function code like below:-
public function personalAgendaSortationStatuses($gridType,$finalFilters) //pass parameter
if (self::GRID_LIST_STATUS_AGENDA === $gridType)
// Personal agenda sortation of statuses
unset($finalFilters['statusId']['distinct']);
$finalFilters['statusId']['values'] = [
BAS_Shared_Model_Ticket::STATUS_REPLY_RELATION => 'relation reply',
BAS_Shared_Model_Ticket::STATUS_REMINDER => 'followup',
BAS_Shared_Model_Ticket::STATUS_NEW => 'new',
BAS_Shared_Model_Ticket::STATUS_IN_PROGRESS => 'in progress',
BAS_Shared_Model_Ticket::STATUS_REOPEN => 'reopened',
];
return $finalFilters;
And call it in another function like this:-
$statuses = $this->personalAgendaSortationStatuses(self::GRID_LIST_STATUS_AGENDA,$finalFilters);//send second parameter too
answered Nov 13 '18 at 7:30
Alive to DieAlive to Die
55.7k82868
55.7k82868
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53275731%2fcall-a-function-inside-a-if-condition%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
yes its working..thank you thanks a lot
– suresh
Nov 13 '18 at 7:28
from the first function you returned some data to second function and now it's up-to-you that what you want to do with that data. if you want to return then use return , if you want to print print there. completely your choice as well as depended on what the second function intended to do.
– Alive to Die
Nov 13 '18 at 7:35
i have already used return $finalFilters; in my old function now we have used same in our current function so can i remove that in my old fucntion? it wont make any problem to my old fucntion rite?
– suresh
Nov 13 '18 at 7:35
1
one function cannot have 2 returns. you can use array to return multiple data at a time from one function
– Alive to Die
Nov 13 '18 at 7:40
1
okay sure..thank you for your help
– suresh
Nov 13 '18 at 7:52