i want to get a param from module.php in any model but i have the error
above. What is the solution. i try all the solutions in form but i couldn't
solve

my module.php

  public function getServiceConfig()
    {
            
        return array(
            'factories' => array(
                 'adapter1' => function ($sm) {
                    $dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
                    return $dbAdapter;
                },.....

my model

namespace Sorubankam\Model;


use Zend\Db\Sql\Select;
use Zend\ServiceManager\ServiceLocatorAwareInterface;
use Zend\ServiceManager\ServiceLocatorInterface;

class CustomCls implements ServiceLocatorAwareInterface 
{
      protected $services;

    
      public function setServiceLocator(ServiceLocatorInterface
$serviceLocator)
    {
        $this->services = $serviceLocator;
    }

    public function getServiceLocator()
    {
        return $this->services;
    }

      public function deneme()
    {
            $adapter=$this->services->get("Sorubankam\Model\CustomCls"); /*
Error line */  



--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/ServiceLocator-in-Model-classes-Error-Call-to-a-member-function-get-on-a-non-object-tp4661568.html
Sent from the Zend Framework mailing list archive at Nabble.com.

-- 
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to