Diferencia entre revisiones de «Cheat sheet beta1»

De KumbiaPHP Framework Wiki
(Cheat Sheet version 1.0beta1)
 
Línea 5: Línea 5:
  
 
[[Archivo:Chuleta.jpg]]
 
[[Archivo:Chuleta.jpg]]
 +
 +
 +
Aqui esta el contenido de la chuleta; usenlo para crear sus propias versiones :)
 +
 +
 +
Clases
 +
Load::lib(string $nombre)
 +
Load::model(string $nombre)
 +
Load::models(array $nombres)
 +
 +
Flash::error(string $mensaje)
 +
Flash::success(string $mensaje)
 +
Flash::notice(string $mensaje)
 +
Flash::warning(string $mensaje)
 +
 +
Session::set(string $nombre, $valor)
 +
Session::get(string $nombre)
 +
Session::unset_data(string $nombre)
 +
Session::isset_data(string $nombre)
 +
 +
 +
Upload::file_in_path(string $nombre, string $path, string $nuevo_nombre)
 +
Upload::file(string $nombre, string $nuevo_nombre)
 +
Upload::image(string $nombre, string $nuevo_nombre)
 +
 +
 +
Filter
 +
 +
 +
Add_filter($filter)
 +
Apply($var, [filters]) y apply_filter($var, [filters])
 +
Get_instance()
 +
 +
aqui faltan mas y en la wiki tambien; tambien tengo dudas si los de abajo estan en la beta1
 +
 +
 +
Filter::get(mixed $s, array $opciones)
 +
Filter::get_array($array, array $opciones)
 +
Filter::get_object($object, array $opciones)
 +
 +
Filtros
 +
addslashes
 +
alnum
 +
alpha
 +
date
 +
digits
 +
htmlentities
 +
htmlspecialchars
 +
int
 +
ipv4
 +
lower
 +
md5
 +
nl2br
 +
numeric
 +
stripslashes
 +
stripspace
 +
striptags
 +
trim
 +
upper
 +
 +
 +
Paths
 +
APP
 +
APP_PATH
 +
CORE_PATH
 +
PUBLIC_PATH
 +
APP_CHARSET
 +
URL_PATH
 +
 +
 +
Constante Descripción
 +
APP Nombre de la Aplicación
 +
APP_PATH ruta absoluta de la aplicación (/path/to/app/)
 +
CORE_PATH ruta absoluta del core (/path/to/core/)
 +
PUBLIC_PATH
 +
URL_PATH
 +
APP_CHARSET
 +
 +
Helpers
 +
 +
form_tag(string $action)
 +
text_field_tag($nombre)
 +
textarea_tag($nombre)
 +
password_field_tag($nombre)
 +
hidden_field_tag($name)
 +
checkbox_field_tag($nombre)
 +
radio_field_tag($nombre, $lista)
 +
date_field_tag($nombre)
 +
file_field_tag($nombre)
 +
upload_image_tag($nombre)
 +
select_tag($name, $lista)
 +
button_tag($caption)
 +
submit_image_tag($caption, $src)
 +
submit_tag($caption)
 +
end_form_tag()
 +
 +
img_tag(string $src)
 +
swf_tag(string $src)
 +
comillas($texto)
 +
 +
render_partial(string $nombre)
 +
link_to(string $url, string $texto)
 +
 +
 +
javascript_include_tag($archivo_js)
 +
javascript_library_tag($archivo_js)
 +
stylesheet_link_tag($archivo_css, [use_variables: true])
 +
 +
 +
Controller
 +
Metodos
 +
 +
render(string $view)
 +
post(array $valor)
 +
get(array $valor)
 +
request($valor)
 +
route_to([params: valor])
 +
redirect(string $controlador, integer $segundos)
 +
cache_layout(integer $minutos)
 +
not_found(string $controller, string $action)
 +
set_response(string $tipo)
 +
is_alnum($valor)
 +
load_record($registro)
 +
is_numeric($valor)
 +
 +
has_post(string $nombre) //Verifica si existe una variable dentro del array $_POST
 +
has_get(string $nombre) //Verifica si existe una variable dentro del array $_GET
 +
has_request(string $nombre) //Verifica si existe una variable dentro del array $_REQUEST
 +
 +
 +
set_persistent(string $nombre, $valor) //hace persistente valores para el controlador actual
 +
get_persistent(string $nombre) //Recupera el el valor persistente
 +
destroy_persistent(string $nombre) //destruye el valor persistente
 +
 +
 +
Propiedades
 +
$action_name -» Nombre de la accion actual
 +
$controller_name -» Nnmbre del controller actual
 +
$template -» Nombre del template a usar
 +
$debug -» Activacion del modo Debug
 +
 +
 +
 +
Filtros
 +
before_filter()
 +
after_filter()
 +
 +
 +
 +
Models
 +
ACTIVE RECORD
 +
 +
Consultas
 +
 +
distinct([string $atributo_entidad], [“conditions: …], [“order: …”], [“limit: …“], [“columns: …”])
 +
find_by_sql (string $sql)
 +
find_all_by_sql (string $sql)
 +
find_first([integer $id], [“conditions: …”], [“order: …”], [“limit: …], [“columns: …”])
 +
find([integer $id], [“conditions: …”], [“order: …”], [“limit: …], [“columns: …”])
 +
select_one(string $select_query)
 +
exists([“conditions: …”])
 +
find_all_by(string $campo, string $valor)
 +
find_by_*campo*(string $valor)
 +
find_all_by_*campo*(string $valor)
 +
 +
sql (string $sql)
 +
 +
--------------------------------------------------
 +
 +
count(string $condicion)
 +
count_by_sql(string $sql)
 +
sum(string $campo, [“conditions: …”])
 +
 +
--------------------------------------------------
 +
 +
average(string $campo, [“conditions: …”])
 +
maximum(string $campo, [“conditions: …”])
 +
minimum(string $campo, [“conditions: …”])
 +
 +
--------------------------------------------------
 +
 +
 +
create()
 +
update()
 +
update_all( [“conditions: …”])
 +
save()
 +
create_from_request()
 +
save_from_request()
 +
delete(integer $id)
 +
delete_all()
 +
 +
 +
Validaciones
 +
 +
validates_presence_of(string $campo)
 +
validates_length_of(string $campo,  [“parametros: …”])
 +
validates_numericality_of(string $campo)
 +
validates_email_in(string $campo)
 +
validates_uniqueness_of(string $campo)
 +
validates_date_in(string $campo)
 +
validates_format_of(string $campo, string $expresion_regular)
 +
 +
Parametros
 +
maximum -» Valor maximo para insertar o actualizar
 +
too_long -» mensaje de alerta para el exceso de maximun
 +
minimum -» Valor minimo para insertar o actualizar
 +
 +
too_short -» mensaje de alerta para el exceso de minimum
 +
 +
in -» Rango del valor para insertar o actualizar
 +
 +
 +
 +
Callbacks
 +
 +
before_create
 +
after_create
 +
 +
before_save
 +
after_save
 +
 +
 +
before_update
 +
after_update
 +
 +
before_delete
 +
after_delete
 +
 +
before_validation
 +
 +
after_validation
 +
 +
 +
before_validation_on_create
 +
after_validation_on_create
 +
 +
before_validation_on_update
 +
after_validation_on_update
 +
 +
 +
Convenciones
 +
id -» Nombre de llave primaria
 +
tabla_id -» Nombre de llave foranea
 +
 +
campo_at -» Campo de tipo fecha fija
 +
campo_in -» Campo de tipo fecha actualizable
 +
 +
 +
 +
Asociaciones
 +
 +
belongs_to(string $relacion,  [“parametros: …”])
 +
has_one(string $relacion,  [“parametros: …”])
 +
has_many(string $relacion,  [“parametros: …”])
 +
has_and_belongs_to_many(string $relacion,  [“parametros: …”])
 +
 +
Parametros
 +
model -»Nombre del modelo
 +
 +
fk -»Nombre del campo foraneo
 +
 +
key -» Nombre del campo primario
 +
 +
through -» Nombre de la tabla relacional

Revisión actual del 22:32 12 may 2010

Hoja de ayuda para la versión 1.0 beta1 (Spirit)

Recordemos que esta hoja de ayuda va para la version 1.0 beta1 Aqui definimos el orden del contenido para luego pasarlo a un PDF o PNG los colores y fuentes no importan, solo el que esten completos, buena sintaxis y en el orden adecuado

Chuleta.jpg


Aqui esta el contenido de la chuleta; usenlo para crear sus propias versiones :)


Clases Load::lib(string $nombre) Load::model(string $nombre) Load::models(array $nombres)

Flash::error(string $mensaje) Flash::success(string $mensaje) Flash::notice(string $mensaje) Flash::warning(string $mensaje)

Session::set(string $nombre, $valor) Session::get(string $nombre) Session::unset_data(string $nombre) Session::isset_data(string $nombre)


Upload::file_in_path(string $nombre, string $path, string $nuevo_nombre) Upload::file(string $nombre, string $nuevo_nombre) Upload::image(string $nombre, string $nuevo_nombre)


Filter


Add_filter($filter) Apply($var, [filters]) y apply_filter($var, [filters]) Get_instance()

aqui faltan mas y en la wiki tambien; tambien tengo dudas si los de abajo estan en la beta1


Filter::get(mixed $s, array $opciones) Filter::get_array($array, array $opciones) Filter::get_object($object, array $opciones)

Filtros addslashes alnum alpha date digits htmlentities htmlspecialchars int ipv4 lower md5 nl2br numeric stripslashes stripspace striptags trim upper


Paths APP APP_PATH CORE_PATH PUBLIC_PATH APP_CHARSET URL_PATH


Constante Descripción APP Nombre de la Aplicación APP_PATH ruta absoluta de la aplicación (/path/to/app/) CORE_PATH ruta absoluta del core (/path/to/core/) PUBLIC_PATH URL_PATH APP_CHARSET

Helpers

form_tag(string $action) text_field_tag($nombre) textarea_tag($nombre) password_field_tag($nombre) hidden_field_tag($name) checkbox_field_tag($nombre) radio_field_tag($nombre, $lista) date_field_tag($nombre) file_field_tag($nombre) upload_image_tag($nombre) select_tag($name, $lista) button_tag($caption) submit_image_tag($caption, $src) submit_tag($caption) end_form_tag()

img_tag(string $src) swf_tag(string $src) comillas($texto)

render_partial(string $nombre) link_to(string $url, string $texto)


javascript_include_tag($archivo_js) javascript_library_tag($archivo_js) stylesheet_link_tag($archivo_css, [use_variables: true])


Controller Metodos

render(string $view) post(array $valor) get(array $valor) request($valor) route_to([params: valor]) redirect(string $controlador, integer $segundos) cache_layout(integer $minutos) not_found(string $controller, string $action) set_response(string $tipo) is_alnum($valor) load_record($registro) is_numeric($valor)

has_post(string $nombre) //Verifica si existe una variable dentro del array $_POST has_get(string $nombre) //Verifica si existe una variable dentro del array $_GET has_request(string $nombre) //Verifica si existe una variable dentro del array $_REQUEST


set_persistent(string $nombre, $valor) //hace persistente valores para el controlador actual get_persistent(string $nombre) //Recupera el el valor persistente destroy_persistent(string $nombre) //destruye el valor persistente


Propiedades $action_name -» Nombre de la accion actual $controller_name -» Nnmbre del controller actual $template -» Nombre del template a usar $debug -» Activacion del modo Debug


Filtros before_filter() after_filter()


Models ACTIVE RECORD

Consultas

distinct([string $atributo_entidad], [“conditions: …], [“order: …”], [“limit: …“], [“columns: …”]) find_by_sql (string $sql) find_all_by_sql (string $sql) find_first([integer $id], [“conditions: …”], [“order: …”], [“limit: …], [“columns: …”]) find([integer $id], [“conditions: …”], [“order: …”], [“limit: …], [“columns: …”]) select_one(string $select_query) exists([“conditions: …”]) find_all_by(string $campo, string $valor) find_by_*campo*(string $valor) find_all_by_*campo*(string $valor)

sql (string $sql)


count(string $condicion) count_by_sql(string $sql) sum(string $campo, [“conditions: …”])


average(string $campo, [“conditions: …”]) maximum(string $campo, [“conditions: …”]) minimum(string $campo, [“conditions: …”])



create() update() update_all( [“conditions: …”]) save() create_from_request() save_from_request() delete(integer $id) delete_all()


Validaciones

validates_presence_of(string $campo) validates_length_of(string $campo, [“parametros: …”]) validates_numericality_of(string $campo) validates_email_in(string $campo) validates_uniqueness_of(string $campo) validates_date_in(string $campo) validates_format_of(string $campo, string $expresion_regular)

Parametros maximum -» Valor maximo para insertar o actualizar too_long -» mensaje de alerta para el exceso de maximun minimum -» Valor minimo para insertar o actualizar

too_short -» mensaje de alerta para el exceso de minimum

in -» Rango del valor para insertar o actualizar


Callbacks

before_create after_create

before_save after_save


before_update after_update

before_delete after_delete

before_validation

after_validation


before_validation_on_create after_validation_on_create

before_validation_on_update after_validation_on_update


Convenciones id -» Nombre de llave primaria tabla_id -» Nombre de llave foranea

campo_at -» Campo de tipo fecha fija campo_in -» Campo de tipo fecha actualizable


Asociaciones

belongs_to(string $relacion, [“parametros: …”]) has_one(string $relacion, [“parametros: …”]) has_many(string $relacion, [“parametros: …”]) has_and_belongs_to_many(string $relacion, [“parametros: …”])

Parametros model -»Nombre del modelo

fk -»Nombre del campo foraneo

key -» Nombre del campo primario

through -» Nombre de la tabla relacional