Log message #4161158

# At Username Text
# Jul 23rd 2018, 12:15 flavius lel
# Jul 23rd 2018, 12:14 mr.mjsm good point. come to our university, you will be distinguished prof. in the first week
# Jul 23rd 2018, 12:13 flavius because a tab could be a different number of columns depending on your environment, but a space is always one column :slightly_smiling_face:
# Jul 23rd 2018, 12:12 mr.mjsm isn't it better to use tabs for indentation ? that's what i was taught for python
# Jul 23rd 2018, 12:12 flavius for indentation
# Jul 23rd 2018, 12:12 mr.mjsm why ?
# Jul 23rd 2018, 12:12 flavius also don't use tabs, use spaces :slightly_smiling_face:
# Jul 23rd 2018, 12:11 flavius ``` public function displayName($id) { $this->loadModel('Users'); $user = $this->Users->get($id); echo $user->name; } ```
# Jul 23rd 2018, 12:11 flavius so you need to add `$this->loadModel('Users');` in that function to make it work
# Jul 23rd 2018, 12:10 flavius `$this->Users` means the model that is autoloaded with the controller because the controller has the same name
# Jul 23rd 2018, 12:09 mr.mjsm File uploaded https://cakesf.slack.com/files/UBN7KUDRA/FBV9PPDHT/-.php / https://slack-files.com/T053DPNCM-FBV9PPDHT-05cf54cc7d - this method in the UsersController, i want to use it in the ServersController, if i want to get the user name. I already have the user id. just want to use this method and echo the result
# Jul 23rd 2018, 12:05 mr.mjsm @flavius I need your help
# Jul 23rd 2018, 12:00 flavius @neon1024 did you start using vs code yet?
# Jul 23rd 2018, 11:31 portilloster @neon1024 Will try! Anyway the column type is not a string but a medium blob. I believe that creates anyway that problem.
# Jul 23rd 2018, 11:30 turkles of course all mine were 0 values, but you could replace that with an array of values you want too..
# Jul 23rd 2018, 11:30 neon1024 @portilloster Just create whatever folder you want, it doesn’t matter really. I put my type file there as that’s the folder they use in the core :0
# Jul 23rd 2018, 11:29 turkles if anyone is interested I ended up creating $defaults in my entity constructor: parent::__construct($properties,$options); foreach($defaults as $value) { if (!property_exists($this,$value) andand !isset($this->{$value})) $this->{$value}=0; }
# Jul 23rd 2018, 11:27 dereuromark i meant clementcrown
# Jul 23rd 2018, 11:26 portilloster @dereuromark Can you tell me which pluggin and how to install it?
# Jul 23rd 2018, 11:24 dereuromark you install the plugin as usual
# Jul 23rd 2018, 11:22 portilloster @neon1024 Thanks for reply! I´m trying to implement what you said but I miss the Database folder under src. I´m in cakephp 3.5. Is this normal? Do I need to create the path and the file?
# Jul 23rd 2018, 11:19 turkles yup I am still stuck on making a default entity. How can I populate some fields when I make a brand new entity, without having to put all those values in the newEntity()?
# Jul 23rd 2018, 11:16 clementcrown @dereuromark please do I just download the file and add it in my cakephp application ? i mean https://github.com/dereuromark/cakephp-tools/blob/master/src/Auth/MultiColumnAuthenticate.php
# Jul 23rd 2018, 11:02 neon1024 Afternoon @dereuromark :wave:
# Jul 23rd 2018, 11:01 neon1024 https://book.cakephp.org/3.0/en/controllers/components/authentication.html#creating-custom-authentication-objects
# Jul 23rd 2018, 11:01 neon1024 https://book.cakephp.org/3.0/en/controllers/components/authentication.html#customizing-find-query
# Jul 23rd 2018, 11:00 dereuromark usually a custom finder can be enough however. depends on the use case I guess.
# Jul 23rd 2018, 10:59 clementcrown thanks @dereuromark let me check out the article
# Jul 23rd 2018, 10:59 clementcrown thanks @neon1024 , please can you shed more light on this?
# Jul 23rd 2018, 10:58 dereuromark thats what I use.
# Jul 23rd 2018, 10:57 dereuromark Or use the existing multicolumn adapters, e.g. https://github.com/dereuromark/cakephp-tools/blob/master/src/Auth/MultiColumnAuthenticate.php
# Jul 23rd 2018, 10:56 neon1024 Yes, it’s possible. You could either customise your Auth finder, or write your own Authentication adapter
# Jul 23rd 2018, 10:55 clementcrown @abdualelah.mdy can I have users login to a cakephp application with email/Password or Matric Number/Password? , I have some users who will login with email and password, then I also have some other sets of users who would login with matric number and password, is this possible on a single cakephp installation and database? if yes, please explain.
# Jul 23rd 2018, 10:39 slackebot '\Proffer\Database\Type\FileType');` you can find out more in the book https://book.cakephp.org/3.0/en/orm/database-basics.html#adding-custom-database-types
# Jul 23rd 2018, 10:39 neon1024 @portilloster I would guess that you have not declared a custom data type for the `Foto` field, and as such it is being marshalled into a string, because your database column is a string type. You will probably want a File data type, to get the post array through the marshaller. https://github.com/davidyell/CakePHP3-Proffer/blob/master/src/Database/Type/FileType.php then set the data type `Type::map('proffer.file',
# Jul 23rd 2018, 10:35 mr.mjsm so I am in the server view page, I have the manager id, i want to output the manager name and link it to the manager view page. i have a customized method in the manager controller "displayName ($id)" which will return the name of the manager given the id. how can I use this method in the server view page ?
# Jul 23rd 2018, 10:15 portilloster File uploaded https://cakesf.slack.com/files/U9CUM170B/FBUCJD96U/-.php / https://slack-files.com/T053DPNCM-FBUCJD96U-975d477984
# Jul 23rd 2018, 10:14 portilloster Hi guys! I´m having problems trying to upload a image. I have a controller with a method where the user can edit some of his information, user picture included. When I debug the variable that contain the picture file I just get the name of the file 'name.extension' instead of the array file.
# Jul 23rd 2018, 10:07 fvanhest I’ll have to look within our own application. The $data property remains empty when it is injected in the controller. At the point that the an action (crud) is invoked, the property is filled.
# Jul 23rd 2018, 10:01 neon1024 But it will be set very early, yes, as it’ll be present in the Middleware :slightly_smiling_face:
# Jul 23rd 2018, 10:00 neon1024 Only if the deprecated class is still being used