# |
May 25th 2017, 22:59 |
jeremyharris |
The reason you're getting that error is because the trait constructor doesn't get called |
# |
May 25th 2017, 22:58 |
jeremyharris |
No the trait |
# |
May 25th 2017, 22:58 |
obinoob |
slackebot: You mean the UseData.php class? |
# |
May 25th 2017, 22:57 |
obinoob |
slackebot: in slackebot getUserId() |
# |
May 25th 2017, 22:57 |
jeremyharris |
Also this should probably be a component as it interacts with the controller layer (other components, the response) |
# |
May 25th 2017, 22:57 |
obinoob |
slackebot: https://postimg.org/image/vkktd1f6v/ |
# |
May 25th 2017, 22:57 |
obinoob |
slackebot: someFunction was just an example |
# |
May 25th 2017, 22:56 |
jeremyharris |
Ok what's the problem? Where's "someFunction" |
# |
May 25th 2017, 22:54 |
obinoob |
slackebot: Controller: https://gist.github.com/fccpt/79d0c074d0592a88bd0cc7cb1d482f55 |
# |
May 25th 2017, 22:54 |
obinoob |
slackebot: Trait: https://gist.github.com/fccpt/66962a7b6422ed933e30f04cdf03e00e |
# |
May 25th 2017, 22:53 |
obinoob |
slackebot: First Class https://gist.github.com/fccpt/fc2d887ebbbf2723842c68f831b507dd |
# |
May 25th 2017, 22:44 |
obinoob |
*yep I will never get used to this keyboard |
# |
May 25th 2017, 22:44 |
jeremyharris |
Seems like a fairly obvious error though. Wherever you're calling the function you're calling it on something that doesn't exist |
# |
May 25th 2017, 22:44 |
obinoob |
yesp i will |
# |
May 25th 2017, 22:43 |
jeremyharris |
obinoob gist your object (and its parents/traits) and the call |
# |
May 25th 2017, 22:43 |
obinoob |
I will try to gist a small example of the code |
# |
May 25th 2017, 22:42 |
jeremyharris |
meder_ make sure the controller is in the right namespace and that you have a route for the API prefix |
# |
May 25th 2017, 22:42 |
obinoob |
I have not a single idea on how to do this that is why I'm having a fatal error, what does it mean this: Call to a member function someFunction() on null |
# |
May 25th 2017, 22:41 |
jeremyharris |
Why not lazily construct it? |
# |
May 25th 2017, 22:39 |
obinoob |
anyone ? |
# |
May 25th 2017, 22:38 |
obinoob |
How can I do this? |
# |
May 25th 2017, 22:38 |
obinoob |
I need to create a new class instance on a trait that is being used on a Controller extended class I know that I can write a construtor on the trait and call it on the class that is being used but by default it will override the Controller construct |
# |
May 25th 2017, 22:21 |
obinoob |
Hi, I'm getting a fatal error, what does it mean this: Call to a member function someFunction() on null Error ? |
# |
May 25th 2017, 21:32 |
meder_ |
I made a controller in src/Controller/Api/AttachedImagesController.php but can't access it in /api/attached_images.. controller name is AttachedImagesController. what did I miss? |
# |
May 25th 2017, 21:29 |
inoas |
See you! around |
# |
May 25th 2017, 21:21 |
inoas |
the cache invalidation here sounds hard :( |
# |
May 25th 2017, 21:20 |
inoas |
Reverse routing (going from say Html::ink() to a url) with routes coming from the database should be cached, right? |
# |
May 25th 2017, 21:11 |
meder_ |
thanks! |
# |
May 25th 2017, 21:10 |
jeremyharris |
oh also the sql log in debug kit, might give you insight. anyway I have to go now, good luck! |
# |
May 25th 2017, 21:10 |
meder_ |
ok |
# |
May 25th 2017, 21:10 |
jeremyharris |
debug the entity after the failed save (the save result), it might tell you what you need to know. |
# |
May 25th 2017, 21:08 |
meder_ |
thank you |
# |
May 25th 2017, 21:08 |
meder_ |
yeah, really weird it doesn't. i'll keep messing around with it |
# |
May 25th 2017, 21:08 |
meder_ |
ok |
# |
May 25th 2017, 21:08 |
jeremyharris |
or rule failures |
# |
May 25th 2017, 21:07 |
jeremyharris |
meder_ that patchedentity should save now, assuming there’s no validation errors |
# |
May 25th 2017, 21:06 |
jeremyharris |
explicitly referencing it made it blank? that’s odd indeed |
# |
May 25th 2017, 21:06 |
jeremyharris |
ok so that should work then |
# |
May 25th 2017, 21:05 |
meder_ |
otherwise its like in that gist, populated |
# |
May 25th 2017, 21:05 |
meder_ |
actually, I played around with explicitly referencing 'Attachments' in 'associated', when i explicitly reference it, attachemnts is blank |
# |
May 25th 2017, 21:04 |
meder_ |
ok |