Saving models issue in 0.7.0 & 0.8.0
When I save model it inserts two records in table.
$user = new Users(); $user->save(array( "name" => "Foo", "password" => "Bar" ));
Users table: 1 Foo Bar 2 Foo Bar
The same result when I using: $user->name = 'assad';
UPDATE: Found strange behavior
Controller: Index Action: Index
Inserts 2 records per one save
Controller: Index Action: Test (and others)
Inserts 1 record, this is ok
Hi, sorry but there are unit-tests in the testsuite to test that a single save/create doesn't create more than one record, so that scenario is not possible.
Maybe there are forwards/redirects to the index/index action that produce this behavior. Please add the following code to your index method to check where these forwards come from:
file_put_contents('log.txt', print_r(debug_backtrace(), true), FILE_APPEND);
Thats weird. Becaus I check it on empty created project with developers tool. =/ Here is a log: https://docs.google.com/file/d/0B2Z2j9phj5MHYnBUMFVUMTc5eW8/edit
Also I have override save method in model (to check redirects) and exit from program like this:
public function save($options = null) {
parent::save($options);
die("Shutdown...");
}
Still add 2 records ...
The log seems to be fine :/
Could you send me please the whole app or code to test it?
Sorry, it something wrong with my NGINX settings. It runs index.php twice for unknown reason. Thanx anyway)
Hi denisov, I have the same issue with NGINX how did you solve it?
This sounds similar to an issue I've had before where the browser is actually requesting the favicon.ico file and Phalcon renders the indexAction. The resolution can be found here
http://forum.phalconphp.com/discussion/2702/facebook-php-sdk-version-4