Situation:
//trollCommand.php [...] foreach ($trolltypes as $type) { //$type=={"Frost","RandomBroken","Forest"} try { $output->writeln($type); $troll={"get".$type."TrollType"}(); $output->writeln("TEST 1"); $troll->__load(); $output->writeln("TEST 2"); } catch (EntityNotFoundException $e) { $output->writeln("WARNING: TROLL ENTITY DOES NOT EXIST."); continue; } $output->writeln("TROLLING"); do_something_with_troll($troll); }
getFrostTrollType loads ok, getForestTrollType should also be loaded by the window, but before that it is a problem, getRandomBrokenTrollType () intentionally does not exist, and then I see a message in the console:
Frost Test 1 Test 2 TROLLING RandomBroken Test 1 [Doctrine\ORM\EntityNotFoundException] Entity was not found. //[EXIT FROM SCRIPT] troll@troll-machine ~/trollSandbox/ $ _
it should be: WARNING: TROLL ENTITY DOES NOT EXIST. and then continue; but this does not happen
How to check existing object method?
php symfony
user3383675
source share