before plugin parameter magento 2
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I am writing a before plugin for below public method.
public function setup($user,$pass,$url = null){
$this->username = $user;
$this->password = $pass;
if ($url) {
$this->uri = $url;
}
return true;
}
I write like below
public function beforeSetup($subject, $user, $pass,$url = null){
$user = "test";
$pass = "hello";
return array($user,$pass,$url);
}
As per dev docs If there is more than one argument, the method should return an array of those arguments.
But am getting : Warning: array_merge(): Argument #2 is not an array
How we handle more than one argument in plugins??
magento2 database plugin interceptor before-plugin
add a comment |
I am writing a before plugin for below public method.
public function setup($user,$pass,$url = null){
$this->username = $user;
$this->password = $pass;
if ($url) {
$this->uri = $url;
}
return true;
}
I write like below
public function beforeSetup($subject, $user, $pass,$url = null){
$user = "test";
$pass = "hello";
return array($user,$pass,$url);
}
As per dev docs If there is more than one argument, the method should return an array of those arguments.
But am getting : Warning: array_merge(): Argument #2 is not an array
How we handle more than one argument in plugins??
magento2 database plugin interceptor before-plugin
Change itreturn array($user,$pass,$url);
toreturn [$user,$pass,$url];
and after that do di compile properly.
– Amit Bera♦
yesterday
it doesn’t help, still the same error
– Daniel_12
yesterday
1
your code seems is ok with me . Very strange it is not working
– Amit Bera♦
yesterday
Just to an tryreturn array($user,$pass,$url = null);
note that first delete all file fromgenerate/code
andgenerate/metadata
then do di compile
– Amit Bera♦
yesterday
if I pass null then it gave meInvalid arguments passed
before applying plugin
– Daniel_12
yesterday
add a comment |
I am writing a before plugin for below public method.
public function setup($user,$pass,$url = null){
$this->username = $user;
$this->password = $pass;
if ($url) {
$this->uri = $url;
}
return true;
}
I write like below
public function beforeSetup($subject, $user, $pass,$url = null){
$user = "test";
$pass = "hello";
return array($user,$pass,$url);
}
As per dev docs If there is more than one argument, the method should return an array of those arguments.
But am getting : Warning: array_merge(): Argument #2 is not an array
How we handle more than one argument in plugins??
magento2 database plugin interceptor before-plugin
I am writing a before plugin for below public method.
public function setup($user,$pass,$url = null){
$this->username = $user;
$this->password = $pass;
if ($url) {
$this->uri = $url;
}
return true;
}
I write like below
public function beforeSetup($subject, $user, $pass,$url = null){
$user = "test";
$pass = "hello";
return array($user,$pass,$url);
}
As per dev docs If there is more than one argument, the method should return an array of those arguments.
But am getting : Warning: array_merge(): Argument #2 is not an array
How we handle more than one argument in plugins??
magento2 database plugin interceptor before-plugin
magento2 database plugin interceptor before-plugin
edited yesterday
Daniel_12
asked yesterday
Daniel_12Daniel_12
16810
16810
Change itreturn array($user,$pass,$url);
toreturn [$user,$pass,$url];
and after that do di compile properly.
– Amit Bera♦
yesterday
it doesn’t help, still the same error
– Daniel_12
yesterday
1
your code seems is ok with me . Very strange it is not working
– Amit Bera♦
yesterday
Just to an tryreturn array($user,$pass,$url = null);
note that first delete all file fromgenerate/code
andgenerate/metadata
then do di compile
– Amit Bera♦
yesterday
if I pass null then it gave meInvalid arguments passed
before applying plugin
– Daniel_12
yesterday
add a comment |
Change itreturn array($user,$pass,$url);
toreturn [$user,$pass,$url];
and after that do di compile properly.
– Amit Bera♦
yesterday
it doesn’t help, still the same error
– Daniel_12
yesterday
1
your code seems is ok with me . Very strange it is not working
– Amit Bera♦
yesterday
Just to an tryreturn array($user,$pass,$url = null);
note that first delete all file fromgenerate/code
andgenerate/metadata
then do di compile
– Amit Bera♦
yesterday
if I pass null then it gave meInvalid arguments passed
before applying plugin
– Daniel_12
yesterday
Change it
return array($user,$pass,$url);
to return [$user,$pass,$url];
and after that do di compile properly.– Amit Bera♦
yesterday
Change it
return array($user,$pass,$url);
to return [$user,$pass,$url];
and after that do di compile properly.– Amit Bera♦
yesterday
it doesn’t help, still the same error
– Daniel_12
yesterday
it doesn’t help, still the same error
– Daniel_12
yesterday
1
1
your code seems is ok with me . Very strange it is not working
– Amit Bera♦
yesterday
your code seems is ok with me . Very strange it is not working
– Amit Bera♦
yesterday
Just to an try
return array($user,$pass,$url = null);
note that first delete all file from generate/code
and generate/metadata
then do di compile– Amit Bera♦
yesterday
Just to an try
return array($user,$pass,$url = null);
note that first delete all file from generate/code
and generate/metadata
then do di compile– Amit Bera♦
yesterday
if I pass null then it gave me
Invalid arguments passed
before applying plugin– Daniel_12
yesterday
if I pass null then it gave me
Invalid arguments passed
before applying plugin– Daniel_12
yesterday
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "479"
};
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: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
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%2fmagento.stackexchange.com%2fquestions%2f269587%2fbefore-plugin-parameter-magento-2%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Magento Stack Exchange!
- 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%2fmagento.stackexchange.com%2fquestions%2f269587%2fbefore-plugin-parameter-magento-2%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
Change it
return array($user,$pass,$url);
toreturn [$user,$pass,$url];
and after that do di compile properly.– Amit Bera♦
yesterday
it doesn’t help, still the same error
– Daniel_12
yesterday
1
your code seems is ok with me . Very strange it is not working
– Amit Bera♦
yesterday
Just to an try
return array($user,$pass,$url = null);
note that first delete all file fromgenerate/code
andgenerate/metadata
then do di compile– Amit Bera♦
yesterday
if I pass null then it gave me
Invalid arguments passed
before applying plugin– Daniel_12
yesterday