本文整理汇总了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;
}
}
示例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);
}
}
}
示例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;
}
示例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);
}
示例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;
}
示例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();
}
示例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?');
}
}
示例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();
}
示例9: set_owner
public function set_owner(ORM $owner)
{
$this->owner_id = $owner->id;
$this->owner_object_name = $owner->object_name();
}