private function car(array $fields) { if (!isset($fields['productId']) || !array_key_exists($fields['productId'], $this->products)) { throw new \Exception('Fake ORM car id not found'); } return RepositoryFactory::get('car', ['price' => $this->products[$fields['productId']]['price']]); }
/** * Retrives the repository type and the repository object. */ public function preExecute() { $this->type = $this->getRequest()->getPostParameter('rep', sfConfig::get('app_repository_type')); $repository_factory = RepositoryFactory::init(); $this->repository = $repository_factory->build($this->type, sfConfig::get('app_repository_' . $this->type)); $log_command_factory = LogCommandFactory::init(); $this->log_command = $log_command_factory->build($this->type); }
function __construct($name, lmbConf $conf) { $this->setName($name); if (!isset(self::$default_conf)) { self::$default_conf = lmbToolkit::instance()->getConf('default_value.conf.php'); } $new_default_conf = $this->_prepareConf(self::$default_conf); $this->_setProjectParams($new_default_conf); $prepared_conf = $this->_prepareConf($conf); $this->_setProjectParams($prepared_conf); $this->repository = RepositoryFactory::create($prepared_conf); $this->orig_conf = $conf; }
public function getRelated($key, $throughColumn, GroupedSelection $table) { return $this->repositoryFactory->createRelated($this->type, $key, $table); }
/** * initalize the factory class * * @return RepositoryFactory */ public static function init() { $class = __CLASS__; return self::$instance = new $class(); }
/** * @return Repository */ public function createRepository() { return $this->repositoryFactory->create($this->name); }