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


PHP Doctrine_Record::toArray方法代码示例

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


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

示例1: _form

 protected function _form(Doctrine_Record $entity)
 {
     $form = $this->_getForm();
     if ($entity->exists()) {
         $form->setDefaults($entity->toArray());
     }
     if ($this->getRequest()->getParam('cancel')) {
         $this->_redirectToIndex();
     }
     if ($this->getRequest()->isPost() && $form->isValid($this->getRequest()->getParams())) {
         $messageKey = 'entityAdded';
         if ($entity->exists()) {
             $messageKey = 'entityUpdated';
         }
         $this->_saveEntity($entity, $form);
         $this->_helper->messenger->success($this->_messages[$messageKey]);
         $this->_redirectToIndex();
     }
     $this->view->form = $form;
 }
开发者ID:prosalov,项目名称:zf1-code-example,代码行数:20,代码来源:Crud.php

示例2: populateDummyRecord

 /**
  * populateDummyRecord
  *
  * @param Doctrine_Record $record 
  * @return Doctrine_Record $record
  */
 public function populateDummyRecord(Doctrine_Record $record)
 {
     $lorem = explode(' ', "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem \n                               Ipsum has been the industry's standard dummy text ever since the 1500s, when an \n                               unknown printer took a galley of type and scrambled it to make a type specimen book. \n                               It has survived not only five centuries, but also the leap into electronic \n                               typesetting, remaining essentially unchanged. It was popularised in the 1960s with \n                               the release of Letraset sheets containing Lorem Ipsum passages, and more recently \n                               with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.");
     $columns = array_keys($record->toArray());
     $pks = $record->getTable()->getIdentifier();
     if (!is_array($pks)) {
         $pks = array($pks);
     }
     foreach ($columns as $column) {
         if (!in_array($column, $pks)) {
             if ($relation = $this->isRelation($record, $column)) {
                 $alias = $relation['alias'];
                 $relationObj = $record->{$alias};
                 $this->populateDummyRecord($relationObj);
             } else {
                 $definition = $record->getTable()->getDefinitionOf($column);
                 switch ($definition['type']) {
                     case 'string':
                         shuffle($lorem);
                         $record->{$column} = substr(implode(' ', $lorem), 0, $definition['length']);
                         break;
                     case 'integer':
                         $record->{$column} = rand();
                         break;
                     case 'boolean':
                         $record->{$column} = true;
                         break;
                     case 'float':
                         $record->{$column} = number_format(rand($definition['length'], $definition['length']), 2, '.', null);
                         break;
                     case 'array':
                         $record->{$column} = array('test' => 'test');
                         break;
                     case 'object':
                         $record->{$column} = new stdObject();
                         break;
                     case 'blob':
                         $record->{$column} = '';
                         break;
                     case 'clob':
                         $record->{$column} = '';
                         break;
                     case 'timestamp':
                         $record->{$column} = date('Y-m-d h:i:s', time());
                         break;
                     case 'time':
                         $record->{$column} = date('h:i:s', time());
                         break;
                     case 'date':
                         $record->{$column} = date('Y-m-d', time());
                         break;
                     case 'enum':
                         $record->{$column} = 'test';
                         break;
                     case 'gzip':
                         $record->{$column} = 'test';
                         break;
                 }
             }
         }
     }
     return $record;
 }
开发者ID:walterfrs,项目名称:mladek,代码行数:69,代码来源:Import.php

示例3: extractFormData

 /**
  * Make array from Doctrine object suitable for supplied form
  *
  * @param  Doctrine_Record $model
  * @param  sfFormDoctrine  $form
  * @return array
  */
 public function extractFormData(Doctrine_Record $model, sfFormDoctrine $form)
 {
     $fields = $form->getWidgetSchema()->getFields();
     $props = $model->toArray();
     return array_intersect_key($props, $fields);
 }
开发者ID:EasyFinance,项目名称:sfPhpunitPlugin,代码行数:13,代码来源:sfPHPUnitObjectHelper.php

示例4: format_radix

 /**
  * Format a Doctrine_Record as an array.
  *
  * @param Doctrine_Record $record
  * @return array $radix
  */
 protected function format_radix(Doctrine_Record $record)
 {
     return $record->toArray();
 }
开发者ID:kaakshay,项目名称:audience-insight-repository,代码行数:10,代码来源:DOCframe_Resource.php

示例5: getObjectProperties

 /**
  * Returns object properties
  *
  * @param Doctrine_Record $object
  *
  * @return array
  */
 public function getObjectProperties($object)
 {
     $array = $object->toArray();
     $t = Doctrine::getTable(get_class($object));
     unset($array[$t->getGeometryColumnName()], $array[$t->getIdentifier()], $array['bbox']);
     return $array;
 }
开发者ID:juacas,项目名称:moodle-mod_treasurehunt,代码行数:14,代码来源:GeoJSON_Adapter_Doctrine.class.php


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