assely / framework

Assely is a PHP framework which brings a little joy to the WordPress development. Develop structured, easily scalable and complex WordPress websites and web applications with true pleasure.
MIT License
57 stars 7 forks source link

Trying to get property of non-object Adapter.php line 51 #36

Closed anoopd closed 7 years ago

anoopd commented 7 years ago

Hi newbie here trying the framework , was just trying to add a menu and i was able to register it but when i tried to render it using

<div class="menu--primary">
    @include('menu.nav', [
        'items' => Menu::get('primary')->items()
    ])
</div>

and was getting the error "Trying to get property of non-object in Adapter.php line 51 . Any idea on why this happens ?

anoopd commented 7 years ago

I am using Bedrock

jedrzejchalubek commented 7 years ago

Could you give me content of the menu.nav template too?

anoopd commented 7 years ago
<ul>
    @foreach($items as $item)
        <li>
            <a href="{{ $item->link }}">{{ $item->title }}</a>
        </li>
    @endforeach
</ul>

in menu/nav.blade.php

anoopd commented 7 years ago

i commented out everything in nav.blade.php and still the error persists

anoopd commented 7 years ago

PHP 7.0.8 (cli) (built: Jun 26 2016 12:30:44) ( NTS ) Copyright (c) 1997-2016 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies with Zend OPcache v7.0.8, Copyright (c) 1999-2016, by Zend Technologies with Xdebug v2.4.0RC3, Copyright (c) 2002-2015, by Derick Rethans

jedrzejchalubek commented 7 years ago

If you comment out entire @include('menu.nav') error still shows up?

anoopd commented 7 years ago

Nope it shows the welcome screen

jedrzejchalubek commented 7 years ago

I still cannot reproduce your error. I've made new project with markup form above and everything works fine.

Make sure you don't have any typos. Try to var_dump $items or $item and see what you get.

jedrzejchalubek commented 7 years ago

Try also to clear views cache. With wp assely:clear views or by deleting storage/framework/views

anoopd commented 7 years ago

sure will dd $items and $item

anoopd commented 7 years ago

Got it !! The error happened since i didnt 'assigned' menu to theme location from WP backend . Now it is working !! Thank you for the support ..... Please let me know how i can support/help you with this project .