public function setName($name) { parent::setName($name); $this->mainSelectionList->setId($name . "_main"); $this->subSelectionList->setName($name); return $this; }
private function _parseFields($results) { $response = array(); foreach ($results as $result) { $field = new Field(); $field->setName($result["Field"]); $field->setType($result["Type"]); $field->setPk($result["Key"] == 'PRI'); $response[] = $field; } return $response; }
private function _parseFields($results, $pk) { $response = array(); foreach ($results as $result) { $field = new Field(); $field->setName($result["field"]); $field->setType($result["type"]); $field->setPk($result["field"] == $pk["col"]); $response[] = $field; } return $response; }
/** * Generate random table fields to test **/ private function getTableFields() { require_once APPPATH . "libraries/scaffolder/drivers/field.php"; $id = new Field(); $id->setName("id"); $id->setPk(true); $nome = new Field(); $nome->setName("nome"); $alias = new Field(); $alias->setName("alias"); $estado = new Field(); $estado->setName("estado_id"); return array($id, $nome, $alias, $estado); }
/** * Get a field, creating it if necessary. * @param $fieldName string * @param $schemaPlugin string * @return object Field */ function &buildField($fieldName, $schemaPluginName) { $field =& $this->getFieldByName($fieldName, $schemaPluginName); if (!$field) { $schemaDao = DAORegistry::getDAO('SchemaDAO'); $schema =& $schemaDao->buildSchema($schemaPluginName); $field = new Field(); $field->setName($fieldName); $field->setSchemaId($schema->getSchemaId()); $plugin =& $field->getSchemaPlugin(); if (!$plugin) { fatalError('Unknown schema plugin "' . $schemaPlugin . '"!'); } if (!in_array($fieldName, $plugin->getFieldList())) { // This field doesn't actually exist -- return null. unset($field); $field = null; return $field; } $this->insertField($field); } return $field; }
/** * * @param array $rows * @param integer $index */ public static function isField($rows, $index) { if (strstr($rows[$index], "@var")) { $field = new Field(self::removeComments($rows[$index], "@var")); $index++; while (!strstr($rows[$index], "*/")) { $row = $rows[$index]; foreach (self::$types as $type => $method) { if (strstr($row, $type)) { $field->{$method}(self::removeComments($row, $type)); } } $index++; } $field->setName(trim(str_replace("protected \$", "", str_replace(";", "", $rows[$index + 1])))); return $field; } else { return false; } }
/** * Sets name for fields, applies mask to dbName creation * @param string $name */ public function setName($name) { parent::setName($name); $this->dbName = null; }
/** * @param $name * @return Field */ public function field($name) { $field = new Field(); $field->setName($name)->setGroup($this->group); $this->setField($field); return $field; }
public function setFields(Field $field) { $this->addItem($field->setName(self::FIELD_KEY)); return $this; }
/** * Descricao : Metodo responsavel por mapear os nodos fields de cada acao. * Este metodo retorna um array de objetos fields que serao validados posteriormente. * * @param Um nodo <field> * @return Um array de objetos Field */ private function createValidation($node) { $fieldArray = array(); if ($node->hasChildNodes()) { $fields = $node->childNodes; foreach ($fields as $field) { $fieldObject = new Field(); if ($field->nodeName == "field") { if ($field->hasAttribute("name")) { $name = $field->getAttribute("name"); $fieldObject->setName($name); } if ($field->hasAttribute("method")) { $method = $field->getAttribute("method"); $fieldObject->setMethod($method); } if ($field->hasAttribute("validationType")) { $validationType = $field->getAttribute("validationType"); $fieldObject->setValidationType($validationType); } $fieldArray[] = $fieldObject; } } } return $fieldArray; }