# |
Jul 7th 2017, 15:15 |
Martin` |
but wished you was able to forward a config to a datatype |
# |
Jul 7th 2017, 15:14 |
Martin` |
I used custom datatypes for my upload plugin :) |
# |
Jul 7th 2017, 15:14 |
hmic |
glanceded: https://book.cakephp.org/3.0/en/orm/database-basics.html#data-types and the following paragraphs is the information you need. searching for "schema" on the book brings you to a wrong place... |
# |
Jul 7th 2017, 15:14 |
jdominguezpaz |
@ebugg @admad I think I got it (also I think I now understand what admad said). I wrote irregular rules "both ways" so, for FrecuenciaSemanal I have: 'frecuenciasemanal'=>'FrecuenciasSemanales', 'FrecuenciaSemanal'=>'frecuenciassemanales', and looks good. Thank you both :slightly_smiling_face: |
# |
Jul 7th 2017, 15:12 |
Martin` |
I liked the type of IP :P |
# |
Jul 7th 2017, 15:12 |
Martin` |
ok :P |
# |
Jul 7th 2017, 15:12 |
Martin` |
:P |
# |
Jul 7th 2017, 15:11 |
hmic |
dereuromark: thats quite odd |
# |
Jul 7th 2017, 15:10 |
hmic |
Martin`, i just made that name up, can be anything you like. seemed kind of fitting for the thing in question |
# |
Jul 7th 2017, 15:09 |
dereuromark |
jep |
# |
Jul 7th 2017, 15:09 |
Martin` |
IPType? |
# |
Jul 7th 2017, 15:09 |
hmic |
or are you talking about echo $entity->dateTimeField is correct but $this->Form->input('dateTimeField') is wrong? |
# |
Jul 7th 2017, 15:09 |
dereuromark |
I did |
# |
Jul 7th 2017, 15:08 |
hmic |
dereuromark: set your locale timezone in bootstrap! |
# |
Jul 7th 2017, 15:07 |
hmic |
maybe/probably you can just do: $table->getSchema()->columnType('your_ip_field', '\App\Model\Types\IPType'); in one line in 3.4 |
# |
Jul 7th 2017, 15:07 |
dereuromark |
did anyone write localized form input widgets for datetime? currently they are two hours (gmt 0 vs 2) off for me... |
# |
Jul 7th 2017, 15:05 |
hmic |
these 2 things go in your table::initialize() function, btw. |
# |
Jul 7th 2017, 15:05 |
glanceded |
ok, i'll try :) |
# |
Jul 7th 2017, 15:04 |
hmic |
you need to map the IPType before too: Type::map('IPType', '\App\Model\...\IPType'); and have it defined in that dir/namespace with the corresponding class name |
# |
Jul 7th 2017, 15:03 |
jdominguezpaz |
it* |
# |
Jul 7th 2017, 15:03 |
jdominguezpaz |
@jarard01 If the .ctp is not created in that route it will show the one in the framework. You have to create the missing_controller.ctp in that route to override ir. |
# |
Jul 7th 2017, 15:03 |
hmic |
$table->schema()->columnType('yourIPfield', 'IPType'); |
# |
Jul 7th 2017, 15:03 |
glanceded |
ah, sure, didn't think about that, thank you very much |
# |
Jul 7th 2017, 15:02 |
hmic |
glanceded: becaue you tell it in the schema |
# |
Jul 7th 2017, 15:02 |
hmic |
gutts: hans michl |
# |
Jul 7th 2017, 15:01 |
glanceded |
My field in db is int so how would cake know when to swtich datatypes? |
# |
Jul 7th 2017, 15:00 |
gutts |
hah |
# |
Jul 7th 2017, 15:00 |
gutts |
hmic: what does your nick stand for? i always read it as hnic |
# |
Jul 7th 2017, 15:00 |
glanceded |
@hmic I see, so I need to create my own type. I found here how to do that, but I can't find how to use it after I create it |
# |
Jul 7th 2017, 14:58 |
gutts |
with a built-in? |
# |
Jul 7th 2017, 14:58 |
gutts |
is there an easy way to extract the first nested error message in $errors = $model->errors(); after validation? |
# |
Jul 7th 2017, 14:57 |
jarard01 |
although in my case it doesn't seem to be calling either of the views in that location |
# |
Jul 7th 2017, 14:57 |
hmic |
glanceded: you dont need to work in the entity. you need a custom database type to do that |
# |
Jul 7th 2017, 14:56 |
jarard01 |
thanks |
# |
Jul 7th 2017, 14:56 |
jdominguezpaz |
@jarard01 /view/errors/missin_controller.ctp |
# |
Jul 7th 2017, 14:54 |
glanceded |
hi guys. I need to save an ip in my db as integer, using INET6_ATON to "compress" the ip. I think that by usign magic function _setIp on my entity would do the job, but I don't know how to pass the mysql function to the query |
# |
Jul 7th 2017, 14:54 |
jdominguezpaz |
@admad I'm not sure to understand that... I understand that I can't inflect both words in FrecuenciaSemanal to FrecuenciasSemanales? |
# |
Jul 7th 2017, 14:53 |
jarard01 |
in cake2 if I call a non-existent controller or method, which template is displayed? |
# |
Jul 7th 2017, 14:52 |
admad |
for inflector that's one word not 2. Only the ending of a string matters |
# |
Jul 7th 2017, 14:51 |
hmic |
good work mic_! |
# |
Jul 7th 2017, 14:51 |
jdominguezpaz |
@admad I set the my irregular cases but I think I can't achieve inflecting the 2 words of, for example, "FrecuenciaSemanal" , with those rules. am I mistaken? |