We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

The code is executed 2 times

The structure of my project is a: (I have multi-modular application)

app/ -----app/ -----------site/Module.php -----------site/controllers/IndexController.php -----------site/models/ -----------site/views/ common/ -----------common/ ----------------------library/myClass.php ----------------------library/myClass1.php ----------------------library/myClass2.php public/*

in the controller "IndexController.php" I use the library "myClass.php":

IndexController.php

namespace Phcms\Site\Controllers; use Phs\Common\Library\myClass;

$r = new myClass(); $r-> .... myClass func

further in the library such a simple code:

myClass.php

namespace Phcms\Common\Library;

class myClass extends \Phalcon\Mvc\Controller {

//and there is an entry in the log $logger = new \Phalcon\Logger\Adapter\File( $_SERVER['DOCUMENT_ROOT'] . '/log.log'); $logger->log( date("d.m.Y") );

}

1 for the launch of the class IndexController.php, the log records the two dates. I think I have something wrong, or the way it should be? The method which keeps a log is called only one time, it's 100 percent.



11.9k

$router->setDefaultModule("site"); ??



11.9k

due to the fact that there was this code

$router->add("/", array( "module" => "xxxxx", 'controller' => 'index', 'action' => 'index' ));

fire bug 404 and the controller is carried out 2 times

it solved the problem