Is var_dump or my code?!? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Is var_dump or my code?!? (/showthread.php?tid=23521) |
Is var_dump or my code?!? - El Forum - 10-13-2009 [eluser]taviroquai[/eluser] Hi all, I'm new to CI and I'm getting RECURSIVE echo from var_dump... but i'm sure that I don't have any recursivity in my code. I'm not sure if I can post my code here, but I can explain how is my code: Models: units (loads "unit" model) unit (loads "unitmodel" model) unitmodel (loads "unittype", "unitfeatures" and "requirement" models) unittype unitfeatures requirement Controller: cunit (loads "units" model) passes units data to "units_view" view View: units_vuew (echos vars from object units) When I var_dump the object units, it shows the following: object(Units)#30 (27) { [“dbtable”]=> string(12) “players_unit” [“data”]=> array(1) { [0]=> object(Unit)#32 (28) { [“dbtable”]=> string(12) “players_unit” [“data”]=> object(stdClass)#40 (5) { [“id”]=> string(1) “4” [“amount”]=> string(1) “1” [“geometry”]=> string(25) “��������Xd�I�h�T��P@” [“players_id”]=> string(1) “5” [“units_model_id”]=> string(2) “23” } [“modelo”]=> object(UnitModel)#33 (30) { [“dbtable”]=> string(11) “units_model” [“data”]=> object(stdClass)#42 (11) { [“id”]=> string(2) “23” [“name”]=> string(6) “Apache” [“icon”]=> string(17) “heli_castanho.png” [“scale”]=> string(1) “1” [“hotspot”]=> string(7) “0.4,0.7” [“labelcolor”]=> string(8) “ffffffff” [“labelscale”]=> string(1) “0” [“labelcolormode”]=> string(6) “normal” [“units_type_id”]=> string(1) “9” [“unit_level”]=> string(1) “2” [“requirements_id”]=> string(1) “0” } [“type”]=> object(UnitType)#34 (27) { [“dbtable”]=> string(10) “units_type” [“data”]=> object(stdClass)#44 (5) { [“id”]=> string(1) “9” [“name”]=> string(10) “helicopter” [“max_level”]=> string(1) “3” [“ocean”]=> string(1) “1” [“earth”]=> string(1) “1” } [“_parent_name”]=> string(8) “UnitType” [“list”]=> &object;(Units)#30 (27) { [“dbtable”]=> string(12) “players_unit” [“data”]=> array(1) { [0]=> object(Unit)#32 (28) {.......... RECURSION As you can see... at some point... it says that i have recursion having objects inside objects... the "list" object inside the "type" object... but i can't see this recursion in my code! Here is my class UnitType: Code: <?php If i don't do var_dump, the code runs ok and it don't crashes... What would be? Thanks! Is var_dump or my code?!? - El Forum - 10-13-2009 [eluser]CroNiX[/eluser] Recursion of this type is normal. Even if you have no code written on a blank CI framework, and made 1 controller with nothing in it except this in the constructor var_dump($this) you will see a lot of recursion. This has to do with inheritance (objects extending objects etc..... ) Is var_dump or my code?!? - El Forum - 10-13-2009 [eluser]taviroquai[/eluser] That means that I don't have to worry with CI inheritance which provokes this type of recursion? |