# |
Jun 22nd 2018, 21:52 |
ra7bi |
i got an error with bake ` Wrote `/Applications/AMPPS/www/store/src/Template/Details/edit.ctp` Cannot generate views for models with no primary key ` |
# |
Jun 22nd 2018, 21:52 |
ra7bi |
hi |
# |
Jun 22nd 2018, 18:16 |
elovin |
ah okay, thanks |
# |
Jun 22nd 2018, 18:13 |
lorenzo |
Classes are need only when you want to customize stuff |
# |
Jun 22nd 2018, 18:13 |
lorenzo |
It will use the base table class by default |
# |
Jun 22nd 2018, 18:09 |
elovin |
another question though, as it seems I do not need any table classes to access existing Tables with the TableLocator ? |
# |
Jun 22nd 2018, 18:08 |
elovin |
okay mybad, missed a simple error in my cache config |
# |
Jun 22nd 2018, 18:00 |
elovin |
I tried that, same result, connection is refused, might be an error in my docker-compose |
# |
Jun 22nd 2018, 17:57 |
lorenzo |
What if you use the same port in cake as you did directly in pdo? |
# |
Jun 22nd 2018, 17:46 |
elovin |
any ideas ? |
# |
Jun 22nd 2018, 17:45 |
elovin |
well yes, but I have a different problem right now, I get SQLSTATE[HY000] [2002] Connection refused when using the stand alone app but the regular cakePHP app works just fine with the same database config, also using PDO directly strangely only works with 8889 but im on linux + docker .. |
# |
Jun 22nd 2018, 17:30 |
lorenzo |
elovin still need help with that? |
# |
Jun 22nd 2018, 16:26 |
elovin |
can I just copy the database model folder from my other cakePHP project to the stand alone project where I use the cakePHP orm ? If so, where should I place it ? |
# |
Jun 22nd 2018, 16:25 |
elovin |
Im trying to use only the ORM from CakePHP, I have set the database Configuration and meta data cache, but now I'm wondering where to place the table and entity classes ? |
# |
Jun 22nd 2018, 15:22 |
lorenzo |
right |
# |
Jun 22nd 2018, 15:19 |
neon1024 |
I guess that the `where()` method passes it if the param is a callable? |
# |
Jun 22nd 2018, 15:17 |
neon1024 |
I don’t quite follow the execution path though. Where does `$exp` get set in the callback method? |
# |
Jun 22nd 2018, 15:15 |
lorenzo |
yes |
# |
Jun 22nd 2018, 15:15 |
neon1024 |
Ah, the namespaced functions you mentioned the other day? Perfect example! Thanks @lorenzo |
# |
Jun 22nd 2018, 14:54 |
lorenzo |
```where(gte($field, $val))``` |
# |
Jun 22nd 2018, 14:54 |
lorenzo |
then you can do |
# |
Jun 22nd 2018, 14:53 |
lorenzo |
```function gte($field, $val) { return function ($exp) use ($field, $val) { return $exp->gte($field, $val); } } ``` |
# |
Jun 22nd 2018, 14:52 |
lorenzo |
I’m working on a better way, but you could have you own version today |
# |
Jun 22nd 2018, 14:46 |
neon1024 |
Ooh, it is a bit long isn’t it |
# |
Jun 22nd 2018, 14:44 |
neon1024 |
`where(['Example.field' => $q->func()->gte(10)])`? |
# |
Jun 22nd 2018, 14:43 |
neon1024 |
Is there a neater way to build where clauses with greater than etc, putting the `>=` in the field selector looks horrible |
# |
Jun 22nd 2018, 14:14 |
josbeir |
pas de probleme |
# |
Jun 22nd 2018, 14:14 |
itmpls |
merci |
# |
Jun 22nd 2018, 14:13 |
josbeir |
=> https://book.cakephp.org/3.0/en/migrations.html#generating-migrations-from-an-existing-database |
# |
Jun 22nd 2018, 14:13 |
itmpls |
cool |
# |
Jun 22nd 2018, 14:13 |
neon1024 |
`bin/cake bake migration_snapshot` |
# |
Jun 22nd 2018, 14:13 |
josbeir |
idd |
# |
Jun 22nd 2018, 14:13 |
josbeir |
yes |
# |
Jun 22nd 2018, 14:13 |
neon1024 |
snapshot isn’t it? |
# |
Jun 22nd 2018, 14:13 |
itmpls |
create* |
# |
Jun 22nd 2018, 14:12 |
itmpls |
can migrations/bake dump a migration from an existing table? |
# |
Jun 22nd 2018, 14:08 |
josbeir |
:P |
# |
Jun 22nd 2018, 14:08 |
josbeir |
2-1 |
# |
Jun 22nd 2018, 14:08 |
tim |
@josbeir What do you think the score'll be? :P |
# |
Jun 22nd 2018, 14:01 |
LubosR |
lorenzo, ok thanks ;) |
# |
Jun 22nd 2018, 14:01 |
lorenzo |
LubosR, no composer would not allow the same pacakge name with 2 different constraints |