Hi to all.

I have the following code:

function insertModelAction(){
        Zend_Loader::loadClass('DlModel');
        Zend_Loader::loadClass('DlObject');
        if(!$this->_isAllow){
                $this->_redirect('/');
        }

        if(!$this->_request->isPost()){
            $DlObject = new DlObject();
            $order = 'name';
            $obj = $DlObject->fetchAll(null,$order);

            $this->view->obj = $obj;
            $this->view->form_title = 'Inserisci bene aziendale';
            $this->view->step = 1;
            $this->view->title = "Odino::Dl::InsertModel";
        }else{
            $dlModel = new DlModel();

            $dlObjectId = $this->_request->getPost('object');
            $producer = $this->_request->getPost('producer');
            $model = $this->_request->getPost('model');

            $where = $dlModel->getAdapter()->quoteInto('producer like ?',
$producer);
            $prod = $dlModel->fetchAll($where);
            if($prod->count() > 0){
                $where = $dlModel->getAdapter()->quoteInto('model like ?',
$model);
                $models = $dlModel->fetchAll($where);
                if($models->count() == 0){
                    $data = array('producer' => $producer,
                            'model' => $model,
                            'dl_object_id' => $dlObjectId);
                    $dlModel->insert($data);
                }
            }else{
                $data = array('producer' => $producer,
                        'model' => $model,
                        'dl_object_id' => $dlObjectId);
                $dlModel->insert($data);
            }

            $this->_redirect('/dl/admin/insertModel');
        }
    }

Thi is an action of one controller. If I try to open it (link: <a
href="/dl/admin/insertModel" title="Inserisci Bene">Inserisci Bene</a>)
firefox said it goes on an infinite loop of redirect.
It gives me error even if redircet commands are commented.

I've the problem only with this controller. The init fuction is the same of
the other controllers that work.

Nothing log by php or apache.

Can you help me?

Thanx

Reply via email to