sfDoctrineDataRetriever.class.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /*
  3. * This file is part of the symfony package.
  4. * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
  5. * (c) Jonathan H. Wage <jonwage@gmail.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. /**
  11. * Doctrine data retriever. Used to assist helpers with retrieving data for
  12. * selector options.
  13. *
  14. * @package symfony
  15. * @subpackage doctrine
  16. * @author Fabien Potencier <fabien.potencier@symfony-project.com>
  17. * @author Jonathan H. Wage <jonwage@gmail.com>
  18. * @version SVN: $Id: sfDoctrineDataRetriever.class.php 12089 2008-10-08 20:23:25Z Jonathan.Wage $
  19. */
  20. class sfDoctrineDataRetriever
  21. {
  22. /**
  23. * Used internally by symfony for retrieving objects for selector helper options.
  24. *
  25. * @param string $model Name of the model to retrieve the objects from.
  26. * @param string $peerMethod Name of the peer method to invoke on the Doctrine_Table instance for the model.
  27. */
  28. static public function retrieveObjects($class, $peerMethod = 'findAll')
  29. {
  30. if (!$peerMethod)
  31. {
  32. $peerMethod = 'findAll';
  33. }
  34. $table = Doctrine::getTable($class);
  35. return call_user_func(array($table, $peerMethod));
  36. }
  37. }