View verifyIC.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function verifyIC($ic) | |
{ | |
// be liberal in what you receive | |
$ic = preg_replace('#\s+#', '', $ic); | |
// má požadovaný tvar? | |
if (!preg_match('#^\d{8}$#', $ic)) { | |
return FALSE; |
View gist:bc9566e95f21ad7b2ef0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// $foo = Mage::getModel('..... | |
// $bar = Mage::getModel('..... | |
$transaction = Mage::getModel('core/resource_transaction'); | |
$transaction->addObject($foo); | |
$transaction->addObject($bar); | |
$transaction->save(); // runs save on all objects. On error -> rollback |