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


PHP BasePeer::translateFieldname方法代码示例

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


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

示例1: validateajaxAction

 public function validateajaxAction()
 {
     $request = $this->getRequest();
     if ($request->isPost()) {
         $post_data = $request->getPost();
         $query = new \ClienteQuery();
         $query->filterBy(\BasePeer::translateFieldname('cliente', $post_data['field'], \BasePeer::TYPE_FIELDNAME, \BasePeer::TYPE_PHPNAME), $post_data['value'], \Criteria::EQUAL);
         $exist = $query->exists();
         if ($post_data['field'] == 'cliente_email') {
             $msj = 'correo electrónico en uso';
         }
         return $this->getResponse()->setContent(json_encode(array('exist' => $exist, 'msj' => $msj)));
     }
 }
开发者ID:vicbaporu,项目名称:ITRADE,代码行数:14,代码来源:ClientesController.php

示例2: _update_changes

 /**
  * Inspect the changes made to $object since its last version (the one stored in the database).
  * Update $entry's changes_detail to reflect the changes made.
  *
  * @param mixed $object
  * @param ncChangeLogEntry $entry
  */
 protected static function _update_changes($object, ncChangeLogEntry $entry)
 {
     //hack: remove $object from it's Peer's instance pool before diff is computed
     call_user_func(array(get_class($object->getPeer()), 'removeInstanceFromPool'), $object);
     $new_values = $object->toArray(BasePeer::TYPE_FIELDNAME);
     if (is_array($object->getPrimaryKey())) {
         $stored_object = call_user_func_array(array(get_class($object->getPeer()), 'retrieveByPK'), $object->getPrimaryKey());
     } else {
         $stored_object = call_user_func(array(get_class($object->getPeer()), 'retrieveByPK'), $object->getPrimaryKey());
     }
     if (!$stored_object) {
         // Unable to retrieve object from database: do nothing
         return false;
     }
     $stored_values = $stored_object->toArray(BasePeer::TYPE_FIELDNAME);
     $ignored_fields = self::getIgnoredFields(get_class($object));
     $dbMap = Propel::getDatabaseMap();
     $table = $dbMap->getTable(constant(get_class($object->getPeer()) . '::TABLE_NAME'));
     $diff = array('class' => get_class($object), 'pk' => $object->getPrimaryKey(), 'changes' => array());
     foreach ($new_values as $key => $value) {
         if (in_array($key, $ignored_fields)) {
             continue;
         } elseif ($value != $stored_values[$key]) {
             $column = $table->getColumn(BasePeer::translateFieldname(get_class($object), $key, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_COLNAME));
             list($value_method, $params) = self::extractValueMethod($column);
             $diff['changes'][$key] = array('old' => $stored_object->{$value_method}($params), 'new' => $object->{$value_method}($params), 'field' => $key, 'raw' => array('old' => $stored_values[$key], 'new' => $value));
         }
     }
     if (isset($diff['changes']) && empty($diff['changes'])) {
         return false;
     }
     $entry->setChangesDetail(base64_encode(serialize($diff)));
     return true;
 }
开发者ID:nvidela,项目名称:kimkelen,代码行数:41,代码来源:ncPropelChangeLogBehavior.class.php


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