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


PHP Field类代码示例

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


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

示例1: make

 public static function make()
 {
     $itemFactory = new itemFactory();
     $collectionFactory = new ItemCollectionFactory();
     $fields = new Field();
     return $fields->setItemFactory($itemFactory)->setFactory($collectionFactory)->setFormatter(new FieldFormatter());
 }
开发者ID:RichardAnthonyLee,项目名称:cms-gen,代码行数:7,代码来源:FieldFactory.php

示例2: add

 public function add(Field $field)
 {
     $attr = $field->name();
     $field->setValue($this->entity->{$attr}());
     $this->fields[] = $field;
     return $this;
 }
开发者ID:Cybercraft,项目名称:Framework,代码行数:7,代码来源:Form.class.php

示例3: __construct

 /**
  * Конструктор, нужен для реализации паттерна Observer
  * 
  * @param \REXFramework\forms\Field $field
  * @param mixed $criterion Критерий для валидатора, например, регулярное выражение
  * @param string $message Сообщение об ошибке
  */
 public function __construct(Field $field, $criterion = null, $message = '')
 {
     $this->field = $field;
     $this->criterion = $criterion;
     $this->message = $message;
     $field->attach($this);
 }
开发者ID:BoesesGenie,项目名称:rex-framework,代码行数:14,代码来源:Validator.php

示例4: getKeyKey

 /**
  * @return mixed
  */
 protected function getKeyKey()
 {
     $n = get_called_class();
     if (!isset(self::$k_cache[$n])) {
         $key = null;
         $r = $this->getReflection();
         //Parse the annotations in a class
         $reader = new \Phalcon\Annotations\Reader();
         $parsing = $reader->parse($r->getName());
         //Create the reflection
         $annotations = new \Phalcon\Annotations\Reflection($parsing);
         if ($annotations->getClassAnnotations()->has('key')) {
             $key = $annotations->getClassAnnotations()->get('key');
         } else {
             foreach ($r->getProperties(\ReflectionProperty::IS_PUBLIC) as $property) {
                 if (!$property->isPublic() || $property->isStatic()) {
                     continue;
                 }
                 $f = new Field($r, $property);
                 if ($f->isKey()) {
                     $key = $property->getName();
                     break;
                 }
             }
         }
         self::$k_cache[$n] = $key;
     }
     return self::$k_cache[$n];
 }
开发者ID:kathynka,项目名称:Foundation,代码行数:32,代码来源:DataObject.php

示例5: removeField

 public function removeField(Field $field)
 {
     if (isset($this->fields[$field->getName()])) {
         unset($this->fields[$field->getName()]);
     }
     return $this;
 }
开发者ID:pavelkolomitkin,项目名称:nigma-blog,代码行数:7,代码来源:Form.php

示例6: addField

 /**
  * @param Field $field
  * @throws DuplicateFieldException
  */
 public function addField(Field $field)
 {
     if (isset($this->fields[$field->getName()])) {
         throw new DuplicateFieldException('Field `' . $field->getName() . '` already exists');
     }
     $this->fields[$field->getName()] = $field;
 }
开发者ID:mammothmkiv,项目名称:php-validator,代码行数:11,代码来源:FieldList.php

示例7: resolve

 /**
  * @param Field $field
  *
  * @return array
  */
 public function resolve(Field $field)
 {
     $defaults = ['required' => false, 'label' => $field->getLabel()];
     $definition = $this->registry->findDefinitionFor($field->getDocument());
     $attributes = $definition->getAttributes($field);
     return array_merge($defaults, $this->trim($attributes));
 }
开发者ID:tomaszhanc,项目名称:form-field-bundle,代码行数:12,代码来源:AttributeResolver.php

示例8: process

    public function process($input)
    {
        $id = 0;
        $minesAll  = array();
        while(count($input)>0)
        {           
            $line = array_shift($input);    
            
            if($this->isNewField($line))
            {
                $dim = $this->getFieldDimensions($line);
                $m = $dim[0]; 
                $n = $dim[1]; 
                if(!$this->IsTheEnd($m, $n))
                {
                    if(!$this->isValidDim($m, $n)){
                        throw new Exception ("Error: Invalid field dimensions! $m, $n");
                    }
                    ++$id;
                    $lineNum = 0;
                    $field = new Field($id, $m, $n);
                    $field->setDebug($this->debug);
                    $this->fields[$id] = $field;  
                }             
            }
            else
            {                                
                if( count($this->fields)<=0 ){
                    throw new Exception ("Error something wrong\n");
                }
                $field = $this->getField($id);
                $id = $field->getFieldId();

                /* line data process */
                foreach(str_split($line) as $x=>$cellvalue)
                {
                    $field->addCell($x, $lineNum);
                    /* detecting mines */
                    if($this->isMinedCell($cellvalue)){
                       $minesAll[$id][] = array($x, $lineNum);
                    }
                }
                $this->fields[$id] = $field;
                $lineNum++;
            }
        } 
        
        if(count($minesAll)>0)
        {
            foreach($minesAll as $id=>$mines)
            {
                $field = $this->getField($id); 
                $field = $this->MineField($field, $mines);
            }
            
        }
        
        return $this->getOutput();
    }
开发者ID:rmhdev,项目名称:Agosto-Minesweeper,代码行数:59,代码来源:Exercise.php

示例9: alterField

 function alterField(\Field $field, $add = false)
 {
     $q = $this->db->dsql()->expr('alter table [al_table] add [field_name] [type_expr]');
     $q->setCustom('al_table', $this->table);
     $q->setCustom('field_name', $x = $field->actual_field ?: $field->short_name);
     $q->setCustom('type_expr', $this->db->dsql()->expr($this->resolveFieldType($field->type())));
     $q->execute();
 }
开发者ID:xavocvijay,项目名称:atkschool,代码行数:8,代码来源:AutoCreator.php

示例10: testCanOverrideInvalidRelation

 public function testCanOverrideInvalidRelation()
 {
     $args = array('type' => 'taxonomy', 'taxonomy' => 'category', 'relation' => 'IN');
     $f = new Field($args);
     $defaults = $f->getDefaults();
     $default_relation = $defaults['relation'];
     $this->assertTrue($f->getRelation() == $default_relation);
 }
开发者ID:dsopiarz,项目名称:wp-advanced-search,代码行数:8,代码来源:TestField.php

示例11: DoAddField

 /**
  * @param Field $field
  * @return void
  */
 protected function DoAddField($field)
 {
     $sourceTable = $field->GetSourceTable();
     if (!isset($sourceTable) || $sourceTable == '') {
         $sourceTable = $this->tableName;
     }
     $this->GetSelectCommand()->AddField($sourceTable, $field->GetName(), $field->GetEngFieldType(), $field->GetAlias());
 }
开发者ID:howareyoucolin,项目名称:demo,代码行数:12,代码来源:table_dataset.php

示例12: addField

 /**
  * Add field
  * 
  * @param  Field $field
  * @throws \LogicException
  */
 public function addField(Field $field)
 {
     $name = $field->getName();
     if (isset($this->fields[$name])) {
         throw new \LogicException(sprintf('Field "%s" already exists', $name));
     }
     $this->fields[$name] = $field;
 }
开发者ID:mikemirten,项目名称:ConstructorCMS,代码行数:14,代码来源:Schema.php

示例13: add

 /**
  * Méthode permettant d'ajouter un champ à la liste
  * 
  * @param \OCFram\Field $field
  * @return \OCFram\Form
  */
 public function add(Field $field)
 {
     $attr = $field->name();
     // Récupérer le nom du champ
     $field->setValue($this->entity->{$attr}());
     // Assigner la valeur correspondante au champ
     $this->fields[] = $field;
     // Ajouter le champ passé en argument à la liste des champs
     return $this;
 }
开发者ID:ChristopheMalo,项目名称:SiteWeb-POO-PHP,代码行数:16,代码来源:Form.php

示例14: update

 public function update()
 {
     $f = new Field();
     $f->name = $this->getFieldName();
     $f->type = $this->getFieldType();
     $f->save();
     $this->fieldSetup($f);
     $f->save();
     return $f;
 }
开发者ID:lostkobrakai,项目名称:migrations,代码行数:10,代码来源:FieldMigration.php

示例15: validate

 /**
  * Validates the given data against this constraint. If the constraint was
  * already triggered before, then it will return the last result.
  *
  * @param mixed $data The data
  *
  * @return boolean
  */
 public function validate(Field $field, $data)
 {
     if (true === $this->checked) {
         return;
     }
     $this->checked = true;
     if (true === $this->check($data)) {
         return;
     }
     $field->addError(new Error($field->getInternalName(), $this->getMessage()));
 }
开发者ID:dennis84,项目名称:formz,代码行数:19,代码来源:Constraint.php


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