Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call to a member function getBehavior() on null #83

Open
anashasabelnabi opened this issue Mar 18, 2020 · 6 comments
Open

Call to a member function getBehavior() on null #83

anashasabelnabi opened this issue Mar 18, 2020 · 6 comments

Comments

@anashasabelnabi
Copy link

anashasabelnabi commented Mar 18, 2020

i already do all of this tutorial but when i need to get uploaded image an error occurred
Call to a member function getBehavior() on null

getBehavior('galleryBehavior')->getImages() as $image) { echo Html::img($image->getUrl('medium')); } ?>
@zxbodya
Copy link
Owner

zxbodya commented Mar 18, 2020

it is outside of the extension… - looks like the object on which you are trying to get behavior is null

@anashasabelnabi
Copy link
Author

Error is done but still not printing anything i use foreach in index view of product controller which have model Product
<?php

    foreach($model->getBehavior('galleryBehavior')->getImages() as $image) {
        echo Html::img($image->getUrl('medium'));
    }
    ?></b>

@zxbodya
Copy link
Owner

zxbodya commented Mar 19, 2020

from my understanding of what is happening, it looks like $model is null in when trying to use in a view, probably there is something wrong in the controller when loading it

@anashasabelnabi
Copy link
Author

Do you have zoom account ?

@anashasabelnabi
Copy link
Author

Screenshot from 2020-03-19 18-02-26
Screenshot from 2020-03-19 18-02-03
Screenshot from 2020-03-19 18-01-36

@anashasabelnabi
Copy link
Author

Controller , model , view to show uploaded image , view to upload image
Screenshot from 2020-03-19 18-06-05

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants