Using Package Config in C5.7

Permalink
Getting the following error:
Call to undefined method Concrete\Package\DarkLeft\Controller::config()

controller file looks like this
<?php
namespace Concrete\Package\DarkLeft\Controller\SinglePage\Dashboard;
use \Concrete\Core\Page\Controller\DashboardPageController;
use Loader;
use Package;
class DarkLeft extends DashboardPageController
{
   public function view() {
      $pkg = Package::getByHandle('dark_left');
      if($pkg->config('fID')){
         $this->set('fID',$pkg->config('fID'));
      }
   }
   public function success(){
      $this->set("success","Background Saved");


what am I missing?

MichaelG
 
MichaelG replied on at Permalink Reply
MichaelG
Eh. Got a little closer, I'm still not getting something.

I changed it to this

<?php
namespace Concrete\Package\DarkLeft\Controller\SinglePage\Dashboard;
use \Concrete\Core\Page\Controller\DashboardPageController;
use Loader;
use Package;
use \Concrete\Core\Config\ConfigStore;
class DarkLeft extends DashboardPageController
{
   public function view() {
      $pkg = Package::getByHandle('dark_left');
     $pkgID = $pkg->getPackageID();
      $fID = ConfigStore::get('fID',$pkgID);
            $this->set('fID',$fID);
   }
   public function success(){


It saves, and stores it into the DB, but I can't Get it.
I get the following error: Invalid argument supplied for foreach()

Aaaannny thoughts?
MichaelG replied on at Permalink Reply
MichaelG
anyone?
Mainio replied on at Permalink Reply
Mainio
http://www.concrete5.org/community/forums/customizing_c5/5.7-config-setpackageobject-undefined-function/