Log message #4201854

# At Username Text
# Sep 5th 2019, 14:36 ndm @ondrej.nedvidek Both should work, `set()` as well as `assign()/fetch()`
# Sep 5th 2019, 14:35 ondrej.nedvidek so there is no option or you are not aware about ? :O
# Sep 5th 2019, 14:30 david098 No luck...
# Sep 5th 2019, 14:26 slackebot part of controller action. Any help?
# Sep 5th 2019, 14:26 ondrej.nedvidek Hi there, I am inheriting view and want to pass variable from current view to the parent ``` $this->set('foo', 'bar'); $this->extend('/Common/Posts/view'); ``` I have tried to use `$this->assign('foo', 'bar');` and fetch in Common/Posts/view `$this->fetch('foo')` Also tried `$this->set('foo', 'bar');` and then access in Common/Posts/view `$foo` But no luck either way. It is related to view appearance so I don't think it should be
# Sep 5th 2019, 14:25 ricksaccous @david098 replace the contain by matching, if you need the contain then use both the contain and a matching i suppose
# Sep 5th 2019, 14:24 davorminchorov the form looks like the xeditable jquery plugin where the records for each row can be edited
# Sep 5th 2019, 14:22 davorminchorov Hi, I have a list of records that I want to display on the page, and I am using the paginator but I noticed that the form is lazily loading the form fields as I scroll down. Is there any way to display all (or specific limit of those records) at once before it starts paginating the rest of the records?
# Sep 5th 2019, 14:22 david098 do you mean replace the contain by matching? or add an extra matching ?
# Sep 5th 2019, 14:17 ricksaccous try it...
# Sep 5th 2019, 14:17 david098 Could be the solution, but my brain freezes at the moment, so any suggestion is welcome...
# Sep 5th 2019, 14:14 ricksaccous @david098 wouldn't you just need a matching on statements as well?
# Sep 5th 2019, 14:14 ricksaccous no problem
# Sep 5th 2019, 14:12 g.catania thanks anyway
# Sep 5th 2019, 14:12 g.catania ok solved. My bad! I was using the very same key "capabilities-".$this->request->getSession()->read('Auth.User.id') in two different queries holding different things. I messed up :)
# Sep 5th 2019, 14:12 david098 I added my question to stack overflow, so any help is welcome : https://stackoverflow.com/questions/57807225
# Sep 5th 2019, 14:05 maymeow updated :)
# Sep 5th 2019, 14:04 spriz I'd follow official docs ;P https://book.cakephp.org/3.0/en/orm/table-objects.html#customizing-the-entity-class-a-table-uses
# Sep 5th 2019, 14:04 maymeow when i want to change entity class i can use `protected $_entityClass = ApplicationUser::class;` ??
# Sep 5th 2019, 14:03 slackebot public function validationDefault(Validator $validator) { parent::validationDefault($validator); // TODO: Change the autogenerated stub return $validator; } } ```
# Sep 5th 2019, 14:03 maymeow its cake php ok when i extending table and entity classes? ``` class ApplicationUsersTable extends UsersTable { protected $_entityClass = ApplicationUser::class; public function initialize(array $config) { parent::initialize($config); // TODO: Change the autogenerated stub $this->hasMany('Addresses', [ 'foreignKey' => 'user_id', 'className' => 'PostBox.Addresses' ]); }
# Sep 5th 2019, 13:53 ricksaccous also you might want to clear the cache
# Sep 5th 2019, 13:53 ricksaccous what do you get?
# Sep 5th 2019, 13:52 ricksaccous if you debug after calling toArray()
# Sep 5th 2019, 13:51 g.catania nothing changed
# Sep 5th 2019, 13:51 g.catania I tried already both toArray() and execute()
# Sep 5th 2019, 13:50 ricksaccous lol
# Sep 5th 2019, 13:50 ricksaccous as for why cache even affects that I dunno
# Sep 5th 2019, 13:49 ricksaccous toArray executes the query
# Sep 5th 2019, 13:49 ricksaccous I suppose the query hasn't been executed yet, I think you're not getting a ResultSet object back when you cache, but without cache you are getting one
# Sep 5th 2019, 13:48 ricksaccous ->cache('something')->toArray();
# Sep 5th 2019, 13:48 ricksaccous try adding toArray after cache
# Sep 5th 2019, 13:47 g.catania if I omit the ->cache() part works
# Sep 5th 2019, 13:46 g.catania foreach ($user_capabilities as ....) <- this throws the error reported above
# Sep 5th 2019, 13:46 g.catania $user_capabilities = $this->Capabilities->find() ->contain('CapabilityGroups') ->matching('Groups.Users', function($q) { return $q->where(['Users.id' => $this->request->getSession()->read('Auth.User.id')]); })->cache("capabilities-".$this->request->getSession()->read('Auth.User.id'), 'capabilities');
# Sep 5th 2019, 13:42 g.catania I'm running on CakePHP 3.0.x
# Sep 5th 2019, 13:42 ricksaccous @g.catania show code
# Sep 5th 2019, 13:41 g.catania As matter of fact, my foreach (working flawlessy before cache() introduction) throws: "Objects returned by Cake\ORM\Query::getIterator() must be traversable or implement interface Iterator"
# Sep 5th 2019, 13:40 g.catania Hi guys. I'm having an hard time figuring out why chaining ->cache() to my query, I can't iterate it. From docs I read "->cache() returns this, meaning a Cake\ORM\Query object".
# Sep 5th 2019, 13:39 david098 @colas.ruamps that isn't working either as clients are put multiple times in the resultset for every statement due... ->group(['Clients.id']) is also no solution as only 1 statement is left over in the resultset
# Sep 5th 2019, 13:34 alexdd55976 ok, see your point.