/** * * @param string $object * @param string $action * @param array $params * @return Domstor_List_Common * @throws Exception */ public function create($object, $action, array $params) { if (!Domstor_Helper::checkEstateAction($object, $action)) { throw new Exception('Wrong object/action pair'); } if (Domstor_Helper::isCommerceType($object)) { $object = 'commerce'; } $class = sprintf('Domstor_List_%s_%s', ucfirst($object), ucfirst($action)); $list = new $class($params); return $list; }
/** * * @param string $object * @param string $action * @param array $params * @return Domstor_Detail_Common * @throws Exception */ public function create($object, $action, array $params) { if (!Domstor_Helper::checkEstateAction($object, $action)) { throw new Exception('Wrong object/action pair'); } $offer = ($action == 'purchase' or $action == 'rentuse') ? 'Demand' : 'Supply'; $commerce = array('trade', 'office', 'product', 'storehouse', 'landcom', 'other', 'complex'); if (in_array($object, $commerce)) { $object = 'Commerce'; } $class = sprintf('Domstor_Detail_%s_%s', $offer, ucfirst($object)); $obj = new $class($params); return $obj; }
public function check($object, $action) { return Domstor_Helper::checkEstateAction($object, $action); }