# |
Nov 24th 2017, 10:21 |
willem |
if i create my own class in src\Subfolder\MyClass.php, how can i use standard Cake Components like Auth and use loadModel and such? |
# |
Nov 24th 2017, 10:20 |
neon1024 |
Maybe you’re just missing the `()` ? |
# |
Nov 24th 2017, 10:20 |
neon1024 |
Ah, but Connection has it’s own config https://github.com/cakephp/cakephp/blob/master/src/Datasource/ConnectionInterface.php#L45 |
# |
Nov 24th 2017, 10:19 |
neon1024 |
Well the ConfigInstanceTrait uses `getConfig` https://github.com/cakephp/cakephp/blob/master/src/Core/InstanceConfigTrait.php#L116 |
# |
Nov 24th 2017, 10:17 |
felix |
good morning, how can i retrieve the config of a datasource in cakephp 3? i load the connection by `$ds = ConnectionManager::get($connectionName);` but how can i retrieve the config of the connection/datasource? `$ds->config` doesn't work |
# |
Nov 24th 2017, 10:16 |
neon1024 |
Plus value objects are very on trend right now dahling! ;) |
# |
Nov 24th 2017, 10:16 |
rudy1976s |
@neon1024 yes I will definately turn to a library class , thank you again ! |
# |
Nov 24th 2017, 10:15 |
neon1024 |
With the added bonus of if you needed to make a different navigation you could just implement the same interface |
# |
Nov 24th 2017, 10:14 |
neon1024 |
Then you could typehint against the interface in your component and cell |
# |
Nov 24th 2017, 10:14 |
neon1024 |
Be nice if that was refactored into a library. Then you could hit the remote, build a nice Navigation value object which implements a NavigationInterface |
# |
Nov 24th 2017, 09:52 |
rudy1976s |
ah okay I have a component where there are several functions to access a NAV database using soap webservices |
# |
Nov 24th 2017, 09:51 |
birdy247 |
but to do what? |
# |
Nov 24th 2017, 09:51 |
birdy247 |
You want to access a component |
# |
Nov 24th 2017, 09:51 |
rudy1976s |
@birdy247 could you please explain ? |
# |
Nov 24th 2017, 09:50 |
birdy247 |
@rudy1976s what specifically are you after in the cell? |
# |
Nov 24th 2017, 09:50 |
rudy1976s |
The best solution would be having the ORM dealing directly with NAV but I think I dont have the skills to create a datasource |
# |
Nov 24th 2017, 09:49 |
rudy1976s |
Now I will try to think about refactoring to a bran new class as you advice, thank you ! |
# |
Nov 24th 2017, 09:47 |
neon1024 |
Probably a long dependancy chain for Controllers |
# |
Nov 24th 2017, 09:47 |
neon1024 |
Components are tied to controllers |
# |
Nov 24th 2017, 09:47 |
rudy1976s |
yes it ws my thought too |
# |
Nov 24th 2017, 09:47 |
rudy1976s |
I know the cell scope is quite isolated , but since it is a mini controller, I would expect to be able to have access to the component registry as table registry, but there should be surely a reason |
# |
Nov 24th 2017, 09:46 |
neon1024 |
I think it would be better to refactor the shared code into a separate library class, and then implement that into both the component and the cell personally |
# |
Nov 24th 2017, 09:46 |
neon1024 |
`$componentRegistry->load('\App\Controller\Component\Rudy`);` |
# |
Nov 24th 2017, 09:45 |
neon1024 |
I wonder if, in your cell, you could kinda hack it with `new ComponentRegistry(new Controller)` then just add a component to that |
# |
Nov 24th 2017, 09:45 |
rudy1976s |
Tables can be instantiated without any problems using TableRegistry |
# |
Nov 24th 2017, 09:45 |
neon1024 |
Hm, it takes a controller instance |
# |
Nov 24th 2017, 09:44 |
neon1024 |
Ah, ComponentRegistry |
# |
Nov 24th 2017, 09:44 |
rudy1976s |
yes you are right |
# |
Nov 24th 2017, 09:44 |
neon1024 |
..and I think the ComponentCollection class is only in the Controller |
# |
Nov 24th 2017, 09:43 |
rudy1976s |
I need to use cells to load data coming from a webservice based on Microsoft NAV, but the connector to the webservice and its api is in a component: I have copied the same code to a model and works because usign Table registry I can create an instance of the model table, but I am not happy with this “cheat” |
# |
Nov 24th 2017, 09:43 |
neon1024 |
Doesn’t seem to be from looking at the Cell class |
# |
Nov 24th 2017, 09:42 |
rudy1976s |
btw is there a way in a cell to use a component ? |
# |
Nov 24th 2017, 09:41 |
rudy1976s |
thank you |
# |
Nov 24th 2017, 09:39 |
neon1024 |
The only way it wouldn’t work is if you overloaded it with your own code somewhere in the chain |
# |
Nov 24th 2017, 09:39 |
neon1024 |
As you’re just extending the class and `loadHelper()` is a method in the View class |
# |
Nov 24th 2017, 09:39 |
neon1024 |
I don’t see why you wouldn’t be able to |
# |
Nov 24th 2017, 09:38 |
rudy1976s |
@neon1024 yesterday I followed your hints but extending the view class i was not able to load an helpers in the new view |
# |
Nov 24th 2017, 09:37 |
neon1024 |
No branch for it yet in the repo, or will it come out of `3.next` |
# |
Nov 24th 2017, 09:37 |
neon1024 |
When is 4.0 coming? |
# |
Nov 24th 2017, 09:37 |
neon1024 |
<3 |
# |
Nov 24th 2017, 09:37 |
neon1024 |
Suppose not as it’s immutable |