Thursday, October 30, 2008

Re: AW: Turn off inflections

Works for me. In /app/config/inflections.php:
$uninflectedPlural = array('.*ive');

Then:
debug(Inflector::pluralize('Uebsmwinklusive'));
> Uebsmwinklusive

Do not enter RegEx slashes '/.*/', that screws it up.

BTW, looking at your original problem again, you might rather want to
use the irregular plurals array, since you do need it pluralized for
the table name...

On 30 Oct 2008, at 17:46, Liebermann, Anja Carolin wrote:

>
> Hi David,
>
> I tried out several variations of
> $uninflectedPlural = array('.*ive');
>
> But I either get error messages or nothing happens
>
> Nothing happens: '.*ive'
>
> Errors with:
> '/.*ive/i' gives preg_match() [function.preg-match]: Unknown
> modifier '.'
> '/.*ive/ gives preg_match() [function.preg-match]: Unknown modifier
> '.'
> '/^.*ive$/' gives preg_match() [function.preg-match]: Unknown
> modifier '^' [CORE\cake\libs\inflector.php, line 258]
>
> Any idea what the correct syntax could be?
>
> Thank you in advance!
>
> Anja
>
> -----Ursprüngliche Nachricht-----
> Von: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] Im
> Auftrag von David C. Zentgraf
> Gesendet: Donnerstag, 30. Oktober 2008 00:25
> An: cake-php@googlegroups.com
> Betreff: Re: Turn off inflections
>
>
> Try putting the words you do not want inflected in the
> $uninflectedPlural array.
>
> Gruß,
> Dav
>
> On 30 Oct 2008, at 01:33, Liebermann, Anja Carolin wrote:
>
>>
>> Hi all,
>>
>> I just encountered an error in my program due to inflections.
>>
>> My model is called "Uebsmwinklusive", it uses the table
>> "uebsmwinklusives". What happened, when I tried to use the index.ctp,
>> which uses arrays like: $uebsmwinklusive['Uebsmwinklusive']['id'], I
>> get an error "Undefined index: Uebsmwinklusive".
>> After some poking around I got me the array which arrives in the
>> index.ctp and - ahaaaaa - see there an irregular plural:
>> Array
>> (
>> [0] => Array
>> (
>> [Uebsmwinklusife] => Array
>> (
>> [id] => 10
>> [mwinklusive_id] => 1
>> [sprache_id] => 1 ....
>>
>> Please note the [Uebsmwinklusife] instead of [Uebsmwinklusive]
>>
>> In my inflections.php all my arrays are already empty:
>> $pluralRules = array();
>> $uninflectedPlural = array();
>> $irregularPlural = array();
>> $singularRules = array();
>> $uninflectedSingular = $uninflectedPlural;
>> $irregularSingular = array_flip($irregularPlural);
>>
>> What can I do to get my normal rules? I remember when I baked the
>> application the plural rules really gave me a hard time and we
>> decided
>> to have no language specific plural rules just the mold "Name" in the
>> model becomes "names" in the controller and database table.
>>
>> Any idea where I can check to get rid of the unwanted "ife"?
>>
>> By the way: My model starts like this:
>>
>> class Uebsmwinklusive extends AppModel {
>> var $name = 'Uebsmwinklusive';
>> var $useTable = 'uebsmwinklusives';
>>
>> Thanks a lot in advance!
>>
>> Anja
>>
>>>
>
>
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: