当前位置: 首页>>代码示例>>PHP>>正文


PHP ORM::object_name方法代码示例

本文整理汇总了PHP中ORM::object_name方法的典型用法代码示例。如果您正苦于以下问题:PHP ORM::object_name方法的具体用法?PHP ORM::object_name怎么用?PHP ORM::object_name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ORM的用法示例。


在下文中一共展示了ORM::object_name方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _initialize_file_fields

 /**
  * Initialize file fields
  *
  * @return  void
  */
 protected function _initialize_file_fields()
 {
     // Init file fields
     $def_config = self::$default_file_config;
     if (empty($def_config['dir_chmod'])) {
         $def_config['dir_chmod'] = Ku_Upload::$default_dir_chmod;
     }
     if (empty($def_config['file_chmod'])) {
         $def_config['file_chmod'] = Ku_Upload::$default_file_chmod;
     }
     if (empty($def_config['path'])) {
         $def_config['path'] = Ku_Upload::$default_directory;
     }
     foreach ($this->_file_fields as $field => $config) {
         if (empty($config['path'])) {
             $config['path'] = $def_config['path'] . DIRECTORY_SEPARATOR . $this->_orm->object_name() . DIRECTORY_SEPARATOR . $field;
         }
         $config += $def_config;
         if ($config['uri'] === NULL) {
             $config['uri'] = str_replace('\\', '/', $config['path']);
             if (strlen($config['uri']) > strlen(DOCROOT)) {
                 $config['uri'] = str_replace(str_replace('\\', '/', DOCROOT), '', $config['uri']);
             }
         }
         $config['uri'] = trim($config['uri'], '/');
         $this->_file_fields[$field] = $config;
     }
 }
开发者ID:greor,项目名称:satin-spb,代码行数:33,代码来源:helper.php

示例2: exclude_hidden

 public static function exclude_hidden(ORM $orm, $is_master_site)
 {
     if (!$is_master_site) {
         $hided_list = ORM::factory('hided_List')->where('object_name', '=', $orm->object_name())->find_all()->as_array(NULL, 'element_id');
         if (!empty($hided_list)) {
             $orm->where($orm->primary_key(), 'NOT IN', $hided_list);
         }
     }
 }
开发者ID:greor,项目名称:satin-spb,代码行数:9,代码来源:orm.php

示例3: __construct

 public function __construct(ORM $orm, array $columns = array(), $options = array())
 {
     $this->_options = $options;
     $this->set_name($orm->object_name());
     foreach ($columns as $name => $column) {
         if (!is_array($column)) {
             $column = array('type' => $column);
         }
         $column_cfg = array('name' => $name, 'header' => Arr::get($orm->labels(), $name), 'params' => Arr::get($column, 'params', array()));
         $column = Arr::merge($column_cfg, (array) $column);
         $column = Grid_Column::factory($column);
         $this[$name] = $column;
     }
     $this->_orm = $orm;
 }
开发者ID:ariol,项目名称:adminshop,代码行数:15,代码来源:Grid.php

示例4: __construct

 protected function __construct(ORM $object, array $fields = array())
 {
     $this->_object = $object;
     $this->set_name($object->object_name());
     $hash = '';
     foreach ($fields as $name => $field) {
         if (!is_array($field)) {
             $field = array('type' => $field);
         }
         $field_cfg = array('name' => $name, 'label' => Arr::get($object->labels(), $name), 'value' => $object[$name]);
         $field = Arr::merge($field_cfg, (array) $field);
         $field = Form_Field::factory($field);
         $field->set_object($object);
         $this[$name] = $field;
         $hash .= $field->hash();
     }
     $this->_hash = md5($hash);
 }
开发者ID:ariol,项目名称:adminshop,代码行数:18,代码来源:Orm.php

示例5: save_file

 private function save_file($file_path, ORM $album_orm, $to_head)
 {
     $orm_helper = ORM_Helper::factory('photo');
     try {
         $orm_helper->save(array('owner' => $album_orm->object_name(), 'owner_id' => $album_orm->id, 'title' => Arr::path($_FILES, 'file.name', ''), 'image' => $file_path, 'active' => 1, 'creator_id' => $this->user->id));
         if ($to_head) {
             $config = Arr::get($orm_helper->position_fields(), 'position');
             $position = Session::instance()->get('multiupload_position', $config['step']);
             $orm_helper->position_set('position', $position);
             Session::instance()->set('multiupload_position', $position + $config['step']);
         }
     } catch (ORM_Validation_Exception $e) {
         return implode('. ', $e->errors(''));
     } catch (Exception $e) {
         Kohana::$log->add(Log::ERROR, 'Multiupload error. Exception occurred: :exception', array(':exception' => $e->getMessage()));
         return 'Save error';
     }
     return TRUE;
 }
开发者ID:greor,项目名称:kohana-photo,代码行数:19,代码来源:multiupload.php

示例6: read

 /**
  * Read operation
  *
  * @param  int $id
  * @return ORM
  */
 public function read($id)
 {
     return $this->orm->where($this->orm->object_name() . '.' . $this->orm->primary_key(), '=', $id)->find();
 }
开发者ID:nergal,项目名称:kohana-libs,代码行数:10,代码来源:service.php

示例7: __construct

  /**
   * Creates a new MAttach.
   *
   *     $mattach = new MAttach($user,$log);
   *
   * @param ORM Model
   * @param ORM/String Model to Save
   * @return  void
   */
  public function __construct(ORM $model, $smodel)
  {

    if ($smodel instanceof ORM)
    {
      try
      {
        $this->model = $smodel;
        $this->model->model_id = $model->pk();
        $this->model->model_name = $model->object_name();
      }
      catch (Exception $e)
      {
        throw $e;
      }
    }
    elseif (is_string($smodel))
    {
      try
      {
        $this->model = ORM::factory($smodel);
        $this->model->model_id = $model->pk();
        $this->model->model_name = $model->object_name();
      }
      catch (Exception $e)
      {
        throw $e;
      }
    }
    else
    {
      throw new Exception('WTF?');
    }
  }
开发者ID:nexeck,项目名称:kohana-mattach,代码行数:43,代码来源:core.php

示例8: get

 /**
  * @param ORM $obj
  */
 public static function get($obj)
 {
     return ORM::factory('Seo')->where('model', '=', strtolower($obj->object_name()))->where('pk', '=', $obj->pk())->find();
 }
开发者ID:jfhs,项目名称:amato-seo,代码行数:7,代码来源:Seo.php

示例9: set_owner

 public function set_owner(ORM $owner)
 {
     $this->owner_id = $owner->id;
     $this->owner_object_name = $owner->object_name();
 }
开发者ID:homm,项目名称:thumbler,代码行数:5,代码来源:thumbler.php


注:本文中的ORM::object_name方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。