# |
Oct 1st 2016, 11:39 |
slackebot |
i think, but nothing is saved in floorsmovein_forms. |
# |
Oct 1st 2016, 11:39 |
maikh |
@hmic i have a form with many many inputs. on the one hand i have a multi select where the user checks the floors which he is living on moving out. On the other hand the user has to select floors in which he is moving in. these two should be belongsToMany assocs with floors. In the floors table there are floors which can be selected by users. so in my form i have one field named ```floors._ids``` and the other one ```floorsmovein._ids``` The as |
# |
Oct 1st 2016, 11:36 |
hmic |
maikh: belongsToMany uses a jointable, ever. i dont understand what you want to archive, but if you are sure you dont need one, you might want to use hasMany instead? |
# |
Oct 1st 2016, 11:18 |
maikh |
but allways get an cake error ```SQLSTATE[42S02]: Base table or view not found: 1146 Table 'dmsdigital.floorsmovein' doesn't exist``` |
# |
Oct 1st 2016, 11:18 |
maikh |
i tried it with this: ```$this->belongsToMany('Floors', [ 'className' => 'Floors', 'foreign_key' => 'floor_id', 'propertyName' => 'Floors' ]); $this->belongsToMany('Floorsmovein', [ 'className' => 'Floors', 'foreign_key' => 'floorsmovein_id', 'propertyName' => 'Floorsmovein' ]);``` |
# |
Oct 1st 2016, 11:14 |
maikh |
hey there. i have a model named ```floors``` in this table there are records for floors. Then i have a n:m association to which saves the floors in forms_floors now, i need a new model which should save the floors in forms_floorsmovein how do i realize this with only one table for the floors? |
# |
Oct 1st 2016, 09:09 |
birdy247 |
the through option :) |
# |
Oct 1st 2016, 08:57 |
birdy247 |
how can I enforce school_type_id is not empty? |
# |
Oct 1st 2016, 08:57 |
birdy247 |
I dont have a Table for the joinTable |
# |
Oct 1st 2016, 08:57 |
birdy247 |
echo $this->Form->input('schools.0._joinData.school_type_id', ['empty' => '--Select--']); |
# |
Oct 1st 2016, 08:57 |
birdy247 |
I have a field like this |
# |
Oct 1st 2016, 08:57 |
birdy247 |
morning |
# |
Oct 1st 2016, 01:09 |
ra7bi |
thanks i will try it now |
# |
Oct 1st 2016, 01:06 |
thinkingmedia |
you can do it as a SQL expression or you can do it as binded value |
# |
Oct 1st 2016, 01:06 |
thinkingmedia |
actually, that's the same as just subtracting from the current time. |
# |
Oct 1st 2016, 01:05 |
thinkingmedia |
``` where($query->newExpr("DATE_ADD(created, INTERVAL 2 HOUR) > NOW()")) ``` |
# |
Oct 1st 2016, 01:04 |
ra7bi |
what do you mean ? it's a query for fetching all participants |
# |
Oct 1st 2016, 01:04 |
thinkingmedia |
is this for mysql? |
# |
Oct 1st 2016, 01:03 |
ra7bi |
i want where created+2hours > current time |
# |
Oct 1st 2016, 01:03 |
ra7bi |
this is my Query |
# |
Oct 1st 2016, 01:03 |
ra7bi |
``` $query = $this->Participants->find() ->where(['created >'=>Time::now()->addHours(2)]); ``` |
# |
Oct 1st 2016, 01:02 |
thinkingmedia |
``` $this->find()->where(['created'=>$query-> |
# |
Oct 1st 2016, 01:01 |
thinkingmedia |
``` |
# |
Oct 1st 2016, 01:01 |
thinkingmedia |
f**k |
# |
Oct 1st 2016, 01:01 |
thinkingmedia |
``` |
# |
Oct 1st 2016, 01:01 |
thinkingmedia |
``` |
# |
Oct 1st 2016, 01:01 |
ra7bi |
not current time |
# |
Oct 1st 2016, 01:01 |
ra7bi |
if i do ``` 'created >'=>Time::now()->addHours(2) ``` it will show me where current time plus 2 hours , i want where created plus 2 hours |
# |
Oct 1st 2016, 00:43 |
thinkingmedia |
that is an exact match for `created`. You want to use `created >=` or `created <=` depending on what you want. |
# |
Oct 1st 2016, 00:18 |
graziel |
(Time::now())->addHours(2) |
# |
Oct 1st 2016, 00:10 |
ra7bi |
how should i do it |
# |
Oct 1st 2016, 00:10 |
ra7bi |
i want to say Where created + 2hour > current time ``` ->where(['created'=>Time::now()->addHours(2)]); ``` |
# |
Oct 1st 2016, 00:01 |
graziel |
(new \Cake\I18n\Time())->addHours(2) |
# |
Sep 30th 2016, 23:50 |
ra7bi |
how i can add two hour to Time::now() ? |
# |
Sep 30th 2016, 22:32 |
prepender |
cakephp 3* |
# |
Sep 30th 2016, 22:32 |
prepender |
In cakephp what is faster unions or subqueries? |
# |
Sep 30th 2016, 22:08 |
harry1 |
can anyone help with this: http://stackoverflow.com/questions/39780485/cakephp-crud-api-filtering-fields |
# |
Sep 30th 2016, 21:49 |
ndm |
http://book.cakephp.org/3.0/en/orm/retrieving-data-and-resultsets.html#filtering-by-associated-data |
# |
Sep 30th 2016, 21:48 |
ndm |
@ra7bi What the best way might be always depends... `notMatching('Addresses')` however is most probably the easiest |
# |
Sep 30th 2016, 21:46 |
ra7bi |
:upside_down_face: |
# |
Sep 30th 2016, 21:45 |
savant |
ah shit, dat copy paste :P |