本文整理汇总了PHP中object::from方法的典型用法代码示例。如果您正苦于以下问题:PHP object::from方法的具体用法?PHP object::from怎么用?PHP object::from使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类object
的用法示例。
在下文中一共展示了object::from方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_language_texts_list
public function get_language_texts_list($lang_id = 1)
{
$this->fields_text = array_merge($this->fields_text, array("value_{$lang_id}"));
$this->DB->select(implode(", ", $this->fields_text));
$this->DB->from(LANG_TEXTS_TABLE);
$results = $this->DB->get()->result_array();
if (!empty($results) && is_array($results)) {
$return = array();
foreach ($results as $lang) {
$return[$lang['gid']] = $lang['value_' . $lang_id];
}
return $return;
}
return array();
}
示例2: _get_alerts_count
/**
* Return alerts as array
* @param array $params
* @return integer
*/
private function _get_alerts_count($params = null)
{
$this->DB->select("COUNT(*) AS cnt");
$this->DB->from(SPAM_ALERTS_TABLE);
if (isset($params["where"]) && is_array($params["where"]) && count($params["where"])) {
foreach ($params["where"] as $field => $value) {
$this->DB->where($field, $value);
}
}
if (isset($params["where_in"]) && is_array($params["where_in"]) && count($params["where_in"])) {
foreach ($params["where_in"] as $field => $value) {
$this->DB->where_in($field, $value);
}
}
if (isset($params["where_sql"]) && is_array($params["where_sql"]) && count($params["where_sql"])) {
foreach ($params["where_sql"] as $value) {
$this->DB->where($value);
}
}
$results = $this->DB->get()->result_array();
if (!empty($results) && is_array($results)) {
return intval($results[0]["cnt"]);
}
return 0;
}
示例3: get_users_count
/**
* Return count of administrators by criteria
*
* Available where clauses: where, where_in, where_sql etc.
*
* @param array $params where clauses
* @param array $filter_object_ids filter by identificators
* @return array
*/
public function get_users_count($params = array(), $filter_object_ids = null)
{
$this->DB->select("COUNT(*) AS cnt");
$this->DB->from(AUSERS_TABLE);
if (isset($params["where"]) && is_array($params["where"]) && count($params["where"])) {
foreach ($params["where"] as $field => $value) {
$this->DB->where($field, $value);
}
}
if (isset($params["where_in"]) && is_array($params["where_in"]) && count($params["where_in"])) {
foreach ($params["where_in"] as $field => $value) {
$this->DB->where_in($field, $value);
}
}
if (isset($params["where_sql"]) && is_array($params["where_sql"]) && count($params["where_sql"])) {
foreach ($params["where_sql"] as $value) {
$this->DB->where($value);
}
}
if (isset($filter_object_ids) && is_array($filter_object_ids) && count($filter_object_ids)) {
$this->DB->where_in("id", $filter_object_ids);
}
$result = $this->DB->get()->result();
if (!empty($result)) {
return intval($result[0]->cnt);
} else {
return 0;
}
}
示例4: get_pages_count
/**
* Return number of information pages
*
* @param array $params filters data
* @return integer
*/
public function get_pages_count($params = array())
{
$this->DB->select("COUNT(*) AS cnt");
$this->DB->from(CONTENT_TABLE);
if (isset($params["where"]) && is_array($params["where"]) && count($params["where"])) {
foreach ($params["where"] as $field => $value) {
$this->DB->where($field, $value);
}
}
if (isset($params["where_in"]) && is_array($params["where_in"]) && count($params["where_in"])) {
foreach ($params["where_in"] as $field => $value) {
$this->DB->where_in($field, $value);
}
}
if (isset($params["where_sql"]) && is_array($params["where_sql"]) && count($params["where_sql"])) {
foreach ($params["where_sql"] as $value) {
$this->DB->where($value);
}
}
$result = $this->DB->get()->result();
if (!empty($result)) {
return intval($result[0]->cnt);
} else {
return 0;
}
}
示例5: get_product_count
/**
* Return number of filtered reason objects
* @param array $params filters parameters
* @param array $filter_object_ids filters identifiers
* @return integer
*/
public function get_product_count($params = array(), $filter_object_ids = null)
{
$this->DB->select("COUNT(*) AS cnt");
$this->DB->from(PG_PRODUCTS_TABLE);
if (isset($params["where"]) && is_array($params["where"]) && count($params["where"])) {
foreach ($params["where"] as $field => $value) {
$this->DB->where($field, $value);
}
}
if (isset($params["where_in"]) && is_array($params["where_in"]) && count($params["where_in"])) {
foreach ($params["where_in"] as $field => $value) {
$this->DB->where_in($field, $value);
}
}
if (isset($params["where_sql"]) && is_array($params["where_sql"]) && count($params["where_sql"])) {
foreach ($params["where_sql"] as $value) {
$this->DB->where($value);
}
}
if (isset($filter_object_ids) && is_array($filter_object_ids) && count($filter_object_ids)) {
$this->DB->where_in("id", $filter_object_ids);
}
$results = $this->DB->get()->result_array();
if (!empty($results) && is_array($results)) {
return intval($results[0]["cnt"]);
}
return 0;
}
示例6: get_types
/**
* Return all types as array
* @param boolean $status
* @param array $filter_object_ids
* @param boolean $formatted
* @return array
*/
public function get_types($status = false, $filter_object_ids = null, $formatted = true)
{
$this->DB->select(implode(", ", $this->fields));
$this->DB->from(SPAM_TYPES_TABLE);
if ($status) {
$this->DB->where("status", "1");
}
if (is_array($filter_object_ids)) {
foreach ($filter_object_ids as $value) {
$this->DB->where_in("id", $value);
}
}
$results = $this->DB->get()->result_array();
if (!empty($results) && is_array($results)) {
foreach ($results as $r) {
$this->type_cache[$r['id']] = $this->type_cache[$r['gid']] = $data[$r['id']] = $r;
}
if ($formatted) {
return $this->format_type($data);
} else {
return $data;
}
}
return array();
}
示例7: from
/**
* Set the from table.
*
* @param string $table
* @access public
* @return object the dao object self.
*/
public function from($table)
{
$this->setTable($table);
if ($this->mode == 'raw') {
$this->sqlobj->from($table);
}
return $this;
}
示例8: get_type_by_gid
/**
* Get link type by GID
* @param string $type_gid
* @return mixed
*/
public function get_type_by_gid($type_gid)
{
$type_gid = preg_replace("/[^a-z_]/", "", strtolower($type_gid));
if (!$type_gid) {
return false;
}
$this->DB->select('id, gid, separated, lifetime, unique_type');
$this->DB->from(LINKER_TYPES_TABLE);
$this->DB->where('gid', $type_gid);
//_compile_select;
$result = $this->DB->get()->result();
if (!empty($result)) {
$rt = get_object_vars($result[0]);
$rt["table_name"] = $rt["separated"] ? LINKER_SEPARATED_PREFIX . $rt["gid"] : LINKER_TABLE;
return $rt;
} else {
return false;
}
}
示例9: get_user_groups
/**
* Get user groups
* Get groups a user is in
* @param int|bool $user_id User id to get or FALSE for current user
* @return array Groups
*/
public function get_user_groups($user_id = FALSE)
{
if ($user_id == FALSE) {
$user_id = $this->CI->session->userdata('id');
}
$this->aauth_db->select('*');
$this->aauth_db->from($this->config_vars['user_to_group']);
$this->aauth_db->join($this->config_vars['groups'], "id = group_id");
$this->aauth_db->where('user_id', $user_id);
return $query = $this->aauth_db->get()->result();
}
示例10: _get_attaches_count
/**
* Return attachements list
* @param integer $message_id message identifier
* @return array
*/
private function _get_attaches_count($message_ids)
{
$this->DB->select('COUNT(*) AS cnt');
$this->DB->from(MAILBOX_ATTACHES_TABLE);
$this->DB->where_in('id_message', (array) $message_ids);
$results = $this->DB->get()->result_array();
if (!empty($results) && is_array($results)) {
return $results[0]['cnt'];
}
return array();
}
示例11: get_preset_by_gid
/**
* Return preset object by guid
*
* @param string $gid area guid
* @return array
*/
public function get_preset_by_gid($gid)
{
$data = array();
$this->DB->select(implode(",", $this->fields_preset));
$this->DB->from(DYNBLOCKS_PRESETS_TABLE);
$this->DB->where("gid", $gid);
$result = $this->DB->get()->result_array();
if (!empty($result)) {
$data = array_shift($this->format_preset(array($result[0])));
}
return $data;
}
示例12: _buildQuery
/**
* Method to build the query
*
* @access private
* @return string query
*/
protected function _buildQuery()
{
static $instance;
if (!empty($instance)) {
return $instance;
}
$this->_query->select('a.*');
$this->_query->from($this->_default_table . ' AS a');
$this->_buildContentWhere();
$this->_buildContentOrderBy();
$instance = $this->_query->__toString();
return $instance;
}
示例13: _get
/**
* Return mailbox services as array
* @param array $params criteria
* @param integer $page page of results
* @param integer $limits rows per page
* @param array $order_by sorting
* @return array
*/
private function _get($params = array(), $page = null, $limits = null, $order_by = null)
{
$this->DB->select(implode(", ", $this->fields));
$this->DB->from(MAILBOX_SERVICES_TABLE);
if (isset($params["where"]) && is_array($params["where"]) && count($params["where"])) {
foreach ($params["where"] as $field => $value) {
$this->DB->where($field, $value);
}
}
if (isset($params["where_in"]) && is_array($params["where_in"]) && count($params["where_in"])) {
foreach ($params["where_in"] as $field => $value) {
$this->DB->where_in($field, $value);
}
}
if (isset($params["where_sql"]) && is_array($params["where_sql"]) && count($params["where_sql"])) {
foreach ($params["where_sql"] as $value) {
$this->DB->where($value, null, false);
}
}
if (is_array($order_by) && count($order_by) > 0) {
foreach ($order_by as $field => $dir) {
if (in_array($field, $this->fields)) {
$this->DB->order_by($field . " " . $dir);
}
}
} elseif ($order_by) {
$this->DB->order_by($order_by);
}
if (!is_null($page)) {
$page = intval($page) ? intval($page) : 1;
$this->DB->limit($limits, $limits * ($page - 1));
}
$results = $this->DB->get()->result_array();
if (!empty($results) && is_array($results)) {
return $this->format_services($results);
}
return array();
}
示例14: __construct
public function __construct($entity, $limit = 10, $alias = NULL, $order = [], $context = NULL, Loops $loops = NULL)
{
//set alias automatically based on classname
if (!$alias) {
$alias = strtolower(substr($entity, 0, 1));
}
$this->alias = $alias;
$this->entity = is_object($entity) ? get_class($entity) : $entity;
$this->limit = $limit;
parent::__construct($context, $loops);
$loops = $this->getLoops();
$doctrine = $loops->getService("doctrine");
$this->builder = new QueryBuilder($doctrine->entity_manager);
$this->builder->select($alias);
$this->builder->from(is_object($entity) ? get_class($entity) : $entity, $alias);
foreach ($order as $key => $value) {
if (is_array($value) && is_numeric($key)) {
$this->builder->addOrderBy($this->alias . "." . $value[0], $value[1]);
} else {
$this->builder->addOrderBy($this->alias . "." . $key, $value);
}
}
}
示例15: _buildQuery
/**
* Method to build the query
*
* @access private
* @return string query
*/
protected function _buildQuery()
{
static $instance;
if (!empty($instance)) {
return $instance;
}
$this->_query->select('a.*,u.name,t.megnevezes');
$this->_query->from($this->_default_table . ' AS a
left outer join #__temakorok AS t on t.id = a.temakor_id
left outer join #__users AS u on u.id = a.user_id');
$this->_buildContentWhere();
$this->_buildContentOrderBy();
$instance = $this->_query->__toString();
return $instance;
}