title: Magento error Call to a member function getId() on a non-object in
body: <p>I use Magneto 1.9.2 with template intenso... Intenso have many kind of modules - sliders, screen of product, bannerslider, productslider.. I have a bannerslider, but if i make a change, magento fall down with error:</p>
  
  <blockquote>
    <p>Fatal error: Call to a member function getId() on a non-object in /home/dev/web/app/code/local/Itactica/LogoSlider/Model/Resource/Slider/Logos.php on line 33</p>
  </blockquote>
  
  <p>All Code is:</p>
  
  <pre><code>public function saveLogosRelation($slider, $data){
      if (!is_array($data)) {
          $data = array();
      }
      $deleteCondition = $this-&gt;_getWriteAdapter()-&gt;quoteInto('slider_id=?', $slider-&gt;getId());
      $this-&gt;_getWriteAdapter()-&gt;delete($this-&gt;getMainTable(), $deleteCondition);
  
      foreach ($data as $logoId =&gt; $info) {
          $this-&gt;_getWriteAdapter()-&gt;insert($this-&gt;getMainTable(), array(
              'slider_id' =&gt; $slider-&gt;getId(),
              'logo_id' =&gt; $logoId,
              'position'   =&gt; @$info['position']
          ));
      }
      return $this;
  }
  </code></pre>
  
  <p>Row 33 is</p>
  
  <pre><code> $this-&gt;_getWriteAdapter()-&gt;insert($this-&gt;getMainTable(), array(
                  'slider_id' =&gt; $slider-&gt;getId()
  </code></pre>
  
  <p>,</p>
  
  <p>Can I find how to repair this getIt method..?
  I try all things, but it not working still. Can you help me ? Thanks..;)</p>