# |
Oct 11th 2019, 09:59 |
jotpe |
(E.g. If I have different user groups) |
# |
Oct 11th 2019, 09:59 |
johnwayne |
@ndm thanx, `$getAllOpenOrders->toArray()` was the problem (it was not the array |
# |
Oct 11th 2019, 09:59 |
jotpe |
For the Authorization Plugin: I have several Policies and a AdminPolicy which implements BeforePolicyInterface to grant Admin Access. For now I extend all my Policies, but I wonder if there's a more advanced solution? |
# |
Oct 11th 2019, 09:32 |
ndm |
Are you sure that this is the query that is causing it? Also are you sure `$getAllOpenOrders` is an array (and not maybe a query)? And what is `$status`? What exactly does the generated SQL look like? That error usually happens when the table that you want to update is referenced in for example a join or a subquery. |
# |
Oct 11th 2019, 09:23 |
slackebot1 |
update in FROM clause` |
# |
Oct 11th 2019, 09:23 |
johnwayne |
Hi to all, if I try to update multiple records in the single table I am getting error... There is my Query ``` $updateAll = TableRegistry::getTableLocator()->get('Items') ->query() ->update() ->set(['status' => $status]) ->where(['order_id IN ' => $getAllOpenOrders]) ->execute(); $getAllOpenOrders = array with all relevant ids ``` The error is `You can't specify target table 'items' for |
# |
Oct 11th 2019, 09:07 |
peter |
im using cakephp 3 |
# |
Oct 11th 2019, 09:06 |
peter |
Hi, how do I get the the authenticated user id when i use cakedc/users plugin |
# |
Oct 11th 2019, 08:17 |
neon1024 |
Morning all :wave: |
# |
Oct 11th 2019, 07:56 |
nk-sonu |
Issue has been solved using recursive =3 |
# |
Oct 11th 2019, 07:36 |
slackebot1 |
'foreignKey' => 'lead_id'` ` )` ` )` ` )` `);` `$this->paginate = array(` ` 'conditions' => array('FollowupMaildeliver.user_id' => 2),` ` 'contain' => array('Lead'),` ` 'limit' => 20, ` ` 'order' => 'FollowupMaildeliver.id DESC'` `);` `$data = $this->paginate('FollowupMaildeliver');` |
# |
Oct 11th 2019, 07:36 |
nk-sonu |
hi, i was working on a CakePHP 2 project, its an old project. i am trying to fetch association data but "Lead" model data not coming under "FollowupEmail" model. please guide. `$this->loadModel('FollowupMaildeliver');` `$this->loadModel('FollowupEmail');` `$this->loadModel('Lead');` `$this->FollowupEmail->bindModel(` ` array('belongsTo' => array(` ` 'Lead' => array(` ` 'className' => 'Lead',` ` |
# |
Oct 11th 2019, 07:05 |
jotpe |
Morning |
# |
Oct 11th 2019, 06:44 |
alexdd55976 |
morning |
# |
Oct 11th 2019, 05:48 |
spriz |
especially for larger stuff :) |
# |
Oct 11th 2019, 05:48 |
spriz |
it's tough job for PHP to do that |
# |
Oct 11th 2019, 05:48 |
spriz |
I do not believe one will make this too easy |
# |
Oct 11th 2019, 05:48 |
kgb.acct.personal |
I thought there's something like `$collection->sortBy(['field1', 'field2'])` |
# |
Oct 11th 2019, 05:48 |
spriz |
I see - then I would do something like that :slightly_smiling_face: |
# |
Oct 11th 2019, 05:48 |
kgb.acct.personal |
Nope. The collection is from request data. |
# |
Oct 11th 2019, 05:46 |
spriz |
no way to do this in SQL/ |
# |
Oct 11th 2019, 05:46 |
spriz |
and do something like `return $fieldOne . '-' . $fieldTwo` but that can get messy and slow pretty quickly for lager collections :S |
# |
Oct 11th 2019, 05:45 |
spriz |
I guess you would need to use a function in the `->sort()` |
# |
Oct 11th 2019, 05:45 |
kgb.acct.personal |
@spriz Yes. Also assuming that those fields have different types |
# |
Oct 11th 2019, 05:44 |
spriz |
first by field 1, and then by field 2? |
# |
Oct 11th 2019, 05:44 |
spriz |
@kgb.acct.personal how would that be sorted? |
# |
Oct 11th 2019, 05:39 |
kgb.acct.personal |
How do I sort Collection using two fields? |
# |
Oct 11th 2019, 03:04 |
arai.mio.i |
Thank you! |
# |
Oct 11th 2019, 02:53 |
challgren |
@arai.mio.i `$query->enableHydration(false)` https://book.cakephp.org/3.0/en/orm/query-builder.html#getting-arrays-instead-of-entities |
# |
Oct 11th 2019, 02:20 |
Fastidius |
you can just use php to pull data |
# |
Oct 11th 2019, 02:19 |
Fastidius |
is it for display or manipulation? ie can you paginate? |
# |
Oct 11th 2019, 02:18 |
arai.mio.i |
Hello. I need your help. Is it possible to get DB data without convert to ResultSet and Entity? When getting 50K records including datetime column, it seems it takes a long time because all data is converted into Frozentime. |
# |
Oct 11th 2019, 02:18 |
Fastidius |
my new thing is that when we go into a record to view there are add pages which open to a new page. the page has a drop down for client but the client we were in is not selected.. is there an easy way to pass the index item number to a drop down on the opened form? it uses the same client ID value |
# |
Oct 11th 2019, 02:16 |
Fastidius |
hi all, as some of you know i am slowly getting my head around cakephp by playing with UI changes to make life better for users. |
# |
Oct 10th 2019, 19:22 |
ricksaccous |
best way imo |
# |
Oct 10th 2019, 19:22 |
risingtide |
So would I put it in my Posts model then? |
# |
Oct 10th 2019, 19:13 |
ricksaccous |
would be the "cleaner" way |
# |
Oct 10th 2019, 19:13 |
ricksaccous |
and just call that in your controller and be done with it |
# |
Oct 10th 2019, 19:13 |
ricksaccous |
$this->Posts->getLatestPost(int $projectId); |
# |
Oct 10th 2019, 19:13 |
ricksaccous |
if you just had it as a model method though you could just say |
# |
Oct 10th 2019, 19:13 |
ricksaccous |
int he controller you'd feed it the option, then you'd have latest_post available in the veiw |