# |
Jul 5th 2019, 12:10 |
dereuromark |
I had similar issues loading a plugin dynamically :slightly_smiling_face: Without a core fix/improvement here I still have to use these hacks: https://github.com/dereuromark/cakephp-ide-helper/tree/master/src/Utility |
# |
Jul 5th 2019, 12:09 |
ndm |
@rchavik It's possible, via `\Cake\Core\Plugin::getCollection()->add()`, but chances are there might be a better way... why do you need to load it from a controller? |
# |
Jul 5th 2019, 12:06 |
rchavik |
any suggestion on how i can load a plugin from a controller action then? |
# |
Jul 5th 2019, 12:05 |
ndm |
@sjorgefabi If your app isn't already composer based, read https://book.cakephp.org/2.0/en/installation/advanced-installation.html#create-a-cakephp-project on how to use the composer autoloader alongside the CakePHP autoloader, and then just use the PhpOffice library code directly as shown in their docs. |
# |
Jul 5th 2019, 11:57 |
sjorgefabi |
@admad Yes, I had seen it, but it uses phpExcel, and apparently it is no longer maintained: https://github.com/PHPOffice/PHPExcel, where you suggest using phpspreadSheet: https://github.com/PHPOffice/PhpSpreadsheet |
# |
Jul 5th 2019, 11:51 |
admad |
@sjorgefabi https://github.com/dakota/CakeExcel/tree/v1.0.5 |
# |
Jul 5th 2019, 11:50 |
sjorgefabi |
this was what I did until importing, previously download the packete: *$ composer requires phpoffice/phpspreadsheet* then *$ composer install* |
# |
Jul 5th 2019, 11:45 |
sjorgefabi |
Hello everyone, I do a query, I do not know if someone else happened, I'm using version 2 of cake and I need a plugin or library to export data in excel, I'm trying to use: phpspreadsheet: https: //phpspreadsheet.readthedocs .io / en / latest /, and my problem is that I can not use the classes |
# |
Jul 5th 2019, 11:40 |
admad |
no |
# |
Jul 5th 2019, 11:39 |
rchavik |
is it possible to get Application instance from inside a controller? |
# |
Jul 5th 2019, 11:36 |
felix.robaglia |
What is the correct way to access sessions infos (username for exemple) in the view ? Like if I want to echo 'Hello, $user' in the home for example ? thanks ! :slightly_smiling_face: |
# |
Jul 5th 2019, 11:16 |
neothermic |
but seriously, a bug report might work better, especially if there's a way to define how phpstorm can parse the routes |
# |
Jul 5th 2019, 11:15 |
dereuromark |
haha i like that @neothermic |
# |
Jul 5th 2019, 11:12 |
charolastra |
*plural |
# |
Jul 5th 2019, 11:11 |
charolastra |
that seems to be the problem. i have two tables, devices and portals. devices has an 'id' field as PK and portals has a 'device_id' which references devices.id. is plurar/singular correct here? |
# |
Jul 5th 2019, 11:05 |
challgren |
Only if your db is keyed correctly |
# |
Jul 5th 2019, 11:05 |
charolastra |
when baking a one to one relationship, should hasOne() and belongsTo() be handled in both models automaticly? |
# |
Jul 5th 2019, 10:45 |
neothermic |
@dereuromark IMO I'd file that as a bug, you have to have some way of marking a file as "in use by magic" :P |
# |
Jul 5th 2019, 10:04 |
felix.robaglia |
hello, is this normal $this->Session->read('username') returns null if i var_dump it in the view ? I don't know what is the best way to access current Session data in the view. |
# |
Jul 5th 2019, 10:02 |
rchavik |
why is deprecation notices are thrown on the html output but not present in the logs? |
# |
Jul 5th 2019, 09:46 |
rchavik |
found it.. |
# |
Jul 5th 2019, 09:44 |
rchavik |
how to get the whole ServerRequest::$params without triggering the deprecation warning? getParam() needs an argument |
# |
Jul 5th 2019, 09:39 |
dereuromark |
Cake routing magic. The IdeHelper could generate a fake list of $x = new XController(); etc to avoid that maybe into some tmp file? |
# |
Jul 5th 2019, 09:39 |
dereuromark |
the new version of phpstorm thinks controllers are "unused".... |
# |
Jul 5th 2019, 08:59 |
rchavik |
getting "ActionDispatcher::addFilter() is deprecated. This is only available for backwards compatibility with DispatchFilters", which migration step should i read? |
# |
Jul 5th 2019, 08:46 |
felix123 |
that's true, I guess I can just do it case by case too. thanks ! |
# |
Jul 5th 2019, 08:43 |
neothermic |
usually you'd only want a few actions to be root of the domain anyway |
# |
Jul 5th 2019, 08:42 |
felix123 |
is this the correct way ? |
# |
Jul 5th 2019, 08:42 |
felix123 |
$routes->connect('/login',['controller' => 'Users', 'action' => 'login']); |
# |
Jul 5th 2019, 08:42 |
felix123 |
that's what im doing, but right now I do it for each action of the controller, like this : |
# |
Jul 5th 2019, 08:40 |
neothermic |
you'd add a custom route in your routes config file for that |
# |
Jul 5th 2019, 08:39 |
felix123 |
hello, i'd like to know if there is a way to tell cakePHP : all the actions of this controller can be called from the root url, like mydomain.fr/login instead of mydomain.fr/users/login |
# |
Jul 5th 2019, 08:18 |
scuadra |
thank you very much |
# |
Jul 5th 2019, 08:17 |
scuadra |
but from now on I'll use it |
# |
Jul 5th 2019, 08:17 |
scuadra |
well I didn't know that was possible |
# |
Jul 5th 2019, 08:15 |
admad |
why do you need to parse anything when you already have a FrozenTime object? Just use `$instance->i18nFormat()` |
# |
Jul 5th 2019, 08:13 |
scuadra |
@admad well I tried using parseDate and parseDateTime but with no success. I am trying to format the created field which is "object(Cake\I18n\FrozenTime)" to be like ddMMYYYY |
# |
Jul 5th 2019, 07:57 |
admad |
@scuadra I'll let you in on a secret, you access to the TimeHelper's code. So check what's in the `format()` method :slightly_smiling_face: |
# |
Jul 5th 2019, 07:54 |
scuadra |
@admad thank you, but I can't understand which method is equivalent to TimeHelper->format() ? |
# |
Jul 5th 2019, 07:44 |
admad |
@scuadra no, use the `Cake\I18n\Time` class directly. TimeHelper is just a wrapper for it |
# |
Jul 5th 2019, 07:43 |
conehead |
But yes, you could initiate a new Instance |