ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.arFactory.php
Go to the documentation of this file.
1 <?php
2 
3 /******************************************************************************
4  *
5  * This file is part of ILIAS, a powerful learning management system.
6  *
7  * ILIAS is licensed with the GPL-3.0, you should have received a copy
8  * of said license along with the source code.
9  *
10  * If this is not the case or you just want to try ILIAS, you'll find
11  * us at:
12  * https://www.ilias.de
13  * https://github.com/ILIAS-eLearning
14  *
15  *****************************************************************************/
21 class arFactory
22 {
27  public static function getInstance(string $class_name, $primary_key = 0, array $additional_arguments = array()): \ActiveRecord
28  {
29  $ref = new ReflectionClass($class_name);
30  if ($ref->isInstantiable()) {
32  $obj = $ref->newInstanceArgs(array_merge(array($primary_key), $additional_arguments));
33  if (empty($primary_key)) {
34  $obj = clone($obj);
35  }
36  } else {
38  }
39 
40  return $obj;
41  }
42 }
Class ActiveRecord.
Class arFactory.
const PRIVATE_CONTRUCTOR
Class arException.