ocs  2.3.6
About: OCS (Open Conference System) is a Web publishing tool that will create a complete Web presence for your scholarly conference.
  Fossies Dox: ocs-2.3.6.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

DAORegistry.inc.php
Go to the documentation of this file.
1 <?php
2 
16 // $Id$
17 
18 
19 import('db.DAO');
20 
21 class DAORegistry {
22 
29  function &getDAOs() {
30  $daos =& Registry::get('daos', true, array());
31  return $daos;
32  }
33 
41  function &registerDAO($name, &$dao) {
42  $daos =& DAORegistry::getDAOs();
43  if (isset($daos[$name])) {
44  $returner =& $daos[$name];
45  } else {
46  $returner = null;
47  }
48  $daos[$name] =& $dao;
49  return $returner;
50  }
51 
58  function &getDAO($name, $dbconn = null) {
59  $daos =& DAORegistry::getDAOs();
60 
61  if (!isset($daos[$name])) {
62  // Import the required DAO class.
64  $className = $application->getQualifiedDAOName($name);
65  if (!$className) {
66  fatalError('Unrecognized DAO ' . $name . '!');
67  }
68 
69  import($className);
70 
71  // Only instantiate each class of DAO a single time
72  $daos[$name] = new $name();
73  if ($dbconn != null) {
74  // FIXME Needed by installer but shouldn't access member variable directly
75  $daos[$name]->_dataSource = $dbconn;
76  }
77  }
78 
79  return $daos[$name];
80  }
81 }
82 
83 ?>
DAORegistry\getDAOs
& getDAOs()
Definition: DAORegistry.inc.php:29
DAORegistry
Maintains a static list of DAO objects so each DAO is instantiated only once.
Definition: DAORegistry.inc.php:21
$application
$application
Definition: index.php:64
fatalError
if(!function_exists('import')) if(!function_exists('file_get_contents')) fatalError($reason)
Definition: functions.inc.php:39
DAORegistry\registerDAO
& registerDAO($name, &$dao)
Definition: DAORegistry.inc.php:41
PKPApplication\getApplication
& getApplication()
Definition: PKPApplication.inc.php:117
DAORegistry\getDAO
& getDAO($name, $dbconn=null)
Definition: DAORegistry.inc.php:58
php
config TEMPLATE inc php
Definition: config.inc.php:4
Registry\get
& get($key, $createIfEmpty=false, $createWithDefault=null)
Definition: Registry.inc.php:37