This document is for a version of CakePHP that is no longer supported. Please upgrade to a newer release!

Page Contents

Inflector

La clase Inflector toma una cadena y puede manipularla produciendo variaciones en las palabras tales como pluralizacion y notacion de CaMeLlo, siendo accedida normalmente de forma estática. Ejemplo: Inflector::pluralize('ejemplo') retorna «ejemplos».

Class methods

Input

Output

pluralize

Apple, Orange, Person, Man

Apples, Oranges, People, Men

singularize

Apples, Oranges, People, Men

Apple, Orange, Person, Man

camelize

Apple_pie, some_thing, people_person

ApplePie, SomeThing, PeoplePerson

underscore

It should be noted that underscore will only convert camelCase formatted words. Words that contains spaces will be lower-cased, but will not contain an underscore.

applePie, someThing

apple_pie, some_thing

humanize

apple_pie, some_thing, people_person

Apple Pie, Some Thing, People Person

tableize

Apple, UserProfileSetting, Person

apples, user_profile_settings, people

classify

apples, user_profile_settings, people

Apple, UserProfileSetting, Person

variable

apples, user_result, people_people

apples, userResult, peoplePeople

slug

Slug converts special characters into latin versions and converting unmatched characters and spaces to underscores. The slug method expects UTF-8 encoding.

apple purée

apple_puree