/** * Construtor. * * @param Entity $ntity * @throws IllegalArgumentException * */ public function __construct(Entity $entity) { # :init properties $this->_entity = $entity->name(); $this->_schema = $entity->schema(); $this->_alias = $entity->alias(); }
/** * cria o campo que sera adicionado ao form * * @return ElementAbstract * */ public function field(\stdClass $info, $value = NULL) { $field = NULL; $hidden = $this->_FKConfig->isHidden($info->name); if (isset($info->foreignKey) && is_string($info->foreignKey) && FALSE == $hidden) { # cria campo de referencia externa $field = $this->fieldForeign($info->name, Entity::factory($info->foreignKey), $value); } else { $field = new Input($info->name, $hidden ? 'hidden' : 'text'); $field->value = $value; } return $field; }
/** * @return string * */ public function render() { $content = $this::T_COMMAND . ' ' . $this->_entity->qualifiedName() . ' ON ' . $this->_conditional->render(); return str_replace("'", '', $content); }
/** * Verifica se a coluna existe. * * @param string $column * @param Entity $entity * @param string $dataSource * @return boolean * */ public function columnExists($column, $entity, $dataSource) { # relacao de colunas disponiveis na entidade $columns = $entity->columns(); # se a coluna nao estiver disponivel ou na existir uma coluna para o dataSource informado, retorna TRUE; if (FALSE == isset($columns->{$column}) || FALSE == isset($columns->{$column}->{$dataSource})) { return FALSE; } return TRUE; }