CodeIgniter + Doctrine = Me Going Crazy |
[eluser]developer10[/eluser]
[quote author="DigitalSkye" date="1288766076"]extend the doctrine_table class (name must match the doctrine_record). Put your custom functions in the doctrine_table. user.php Code: Class User extends Doctrine_Record { user_table.php Code: Class UserTable extends Doctrine_Table { in your controller Code: $something = UserTable::get_something(); Edit: This allows you to keep your controllers thin and you can call the doctrine_table function from anywhere in your app. http://www.doctrine-project.org/projects...w/en#table[/quote] This helped, thanks! But I'm still confused by the fact one of our members (Burak Guzel) managed to do the same thing without creating additional model file (UserTable.php or user_table.php as you suggested). Instead, he writes custom functions right below the setTableDefinition() and setUp() functions?! It all can be seen in his great tutorial on CI+Doctrine: http://www.phpandstuff.com/articles/code...-and-setup Ato some point (day 11 of the tutorial) he creates this function (and calls it from his controller): Code: <?php So, he actually did not create ForumTable.php to put this custom function into it, but still he is able to call it from in his controller in this fashion: Code: $forums = Doctrine::getTable('Forum'); Maybe I am missiing something, but it seems to me IF there actually is a way of having custom functions inside user.php file (rather than creating UserTable.php) - i'd be happy to learn how to do it. |
Messages In This Thread |
CodeIgniter + Doctrine = Me Going Crazy - by El Forum - 10-30-2010, 04:50 AM
CodeIgniter + Doctrine = Me Going Crazy - by El Forum - 10-30-2010, 10:32 PM
CodeIgniter + Doctrine = Me Going Crazy - by El Forum - 10-31-2010, 03:30 AM
CodeIgniter + Doctrine = Me Going Crazy - by El Forum - 10-31-2010, 07:43 AM
CodeIgniter + Doctrine = Me Going Crazy - by El Forum - 10-31-2010, 07:54 AM
CodeIgniter + Doctrine = Me Going Crazy - by El Forum - 10-31-2010, 08:54 AM
CodeIgniter + Doctrine = Me Going Crazy - by El Forum - 10-31-2010, 09:23 AM
CodeIgniter + Doctrine = Me Going Crazy - by El Forum - 10-31-2010, 01:18 PM
CodeIgniter + Doctrine = Me Going Crazy - by El Forum - 10-31-2010, 01:26 PM
CodeIgniter + Doctrine = Me Going Crazy - by El Forum - 10-31-2010, 01:53 PM
CodeIgniter + Doctrine = Me Going Crazy - by El Forum - 11-02-2010, 07:34 PM
CodeIgniter + Doctrine = Me Going Crazy - by El Forum - 11-03-2010, 02:34 PM
CodeIgniter + Doctrine = Me Going Crazy - by El Forum - 11-03-2010, 06:56 PM
|