Yii Blog:Error 500 Comment and its behaviors do not have a method or closure named "getUrl" - blogs

i got error from yii blog development Error 500
Comment and its behaviors do not have a method or closure named "getUrl".

actionGetUrl(){
}
add the term action infront of the method which is declared in the controller.
I hope you are access the controller properly.

Related

Calling showOpenFilePicker : how avoid "must come from gesture" when calling class methods

Accessing the local filesystem a la: https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileHandle
If I inline all my code for the show(Open|Save)FilePicker API logic directly in my button event closure or call plain fn's then things work ok. However, if I define a class w/helper methods and call those from my event-handler, and those helpers call the file pickers, then I get this error:
Uncaught DOMException: Failed to execute 'showOpenFilePicker' on 'Window': Must be handling a user gesture to show a file picker.
I assume the the security system is looking at this to establish the gesture context - is there a way to re-establish this context with code running in my class?
Turns out the class methods were a red herring -- the issue has to do with async code and promises -- this is what looses the context and causes the error.
You need to make any calls to the FS without any promise chaining.

Know intended RestController in Spring implementation of ResponseBodyAdvice

The Spring ResponseBodyAdvice allows for handling the JSON-Response. I want to write it to the logger but by this would also like to add the name of the RestController being invoked in this transaction.
Can anyone tell, whether the classname is somewhere available in the parameters of the instance of ResponseBodyAdvice.
Got it. The parameter "MethodParameter" supplied to the "beforeBodyWrite"-method contains the attribute "containingClass" which provides the name of the intended Controller (I found this with testing - did not find any docs about the use of this attribute until now). That will do for me

Trying to clean merged JS/CSS cache, but model "core/design_package" is a non-object

I have made a new PHP file at the root directory of Magento (next to index.php) and it contains this code:
require 'app/bootstrap.php';
require 'app/Mage.php';
Mage::getModel('core/design_package')->cleanMergedJsCss();
Produces this error:
Fatal error: Call to a member function getModelInstance() on a non-object
in /home/edpadev/public_html/stage/bsr/app/Mage.php on line 463
From my understanding, Magento should dig up that particular method in /app/code/core/Mage/Core/Model/Design/Package.php.
I cannot var_dump it since it cannot instantiate it, I just get the same error when trying to do that.
I am able to call our third-party cache module's observer model and use its methods, and use the simple Mage::app()->cleanCache();, but the core function above does not work, though that is how it appears in examples by other developers in Google search results.
Try this. You might need to setup the store
umask(0);
require 'app/Mage.php';
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);

The noticeError method was not found. while using Coldbox and NewRelic for Error tracking

I'm just using NewRelic error trapping for my coldbox application. From OnException method, I'm just sending the error struct to log the error.
My code in onexception method
public function onException(event,rc,prc){
NewRelic.logError( prc.exception.getExceptionStruct());
}
The logerror() method resides in NewRelic.cfc and contains the following code
public boolean function logError(
required struct exception
) {
var cause = arguments.exception;
var params = {
error_id = createUUID(),
type: arguments.exception.type,
message: arguments.exception.message
};
writeDump(this.newRelic);
this.newRelic.noticeError(cause, params);abort;
return true;
}
So while error, I'm gettig the following error.
The noticeError method was not found.
You can see that, the noticeError() method is there in the object, but it is overloaded with arguments.
I'm using the same code for NewRelic error trapping in another coldfusion project without any frameworks.
Calling error.cfm through Cferror tag, and the code in error.cfm as follows
<cfset Application.newRelic.logError( variables.error )>
And in NewRelic.cfc, the logerror() method contains the same code as in the coldbox application. But it is logging errors in NewRelic without any issues.
This is the method I need to notice errors and log it in NewRelic.
noticeError(java.lang.Throwable, java.util.Map)
So I just thought to get the classname of the first argument Cause through the following code from both applications within logError() in NewRelic.cfc, to get the difference.
writeDump(cause.getClass().getName());
I'm getting
coldfusion.runtime.ExceptionScope for Coldbox application
and
coldfusion.runtime.UndefinedVariableException for normal coldfusion application
The cause argument is not throwable from coldbox application. So how to get the original error struct from coldbox application? and make it throwable to fix the noticeError method was not found issue.
The change in the underlying class happens when ColdBox duplicates the error object with CFML's duplicate() method. I doubt that ColdFusion behavior is documented anywhere, but I don't see an easy way to get around it right now other than creating your own instance of a java.langException and populating it with the details of the original error.
If you want to modify the ColdBox core code, this happens here:
https://github.com/ColdBox/coldbox-platform/blob/master/system/web/context/ExceptionBean.cfc#L43
I have entered this ticket for the ColdBox framework for us to review if we can stop duplicating the error object in future versions of the framework.
https://ortussolutions.atlassian.net/browse/COLDBOX-476
Update: Adam Cameron pointed out this ticket in the Adobe bug tracker that details this behavior in the engine. It was closed as "neverFix".
https://bugbase.adobe.com/index.cfm?event=bug&id=3976478

Angular app can't find controller on transclude

I am unable to get my controller linked to my view. If I include the view using ng-view and have the controller name in the route, the transclusion fails in Angular-route.js when it trys to link in the ngViewFillContentFactory. If I use the ng-controller attribute in the view itself, it fails in angular.js on the boundTranscludeFn that binds the controller to the view. In both cases I can see the application and the 'shell' controller are loaded into the DOM. In both cases the error message "Argument 'shell' is not a function".
The ng-app tag is set in the html tag to the name of the application. Why can the application not find the controller? What tiny little detail am I missing?
Here is the error message (I am calling the controller on two different divs) and here is the controller function loaded into the angular controllers collection.
The ng_app attribute is set to "cockpit" in the html tag and in both cases now I am using the router to assign the shell controller to both the view and the ng-included partial. The same thing happens if I assign the ng-attribute tag to "shell" in shell.html only the error occurs in another part of the code.
I am trying to put together a test app to reproduce the problem which I can post on git.
So the problem was how I was constructing my module. I can't tell you exactly what I did wrong because I don't yet understand exactly how modules work. What I did was to reduce the application down until I got it to work and added things back one by one until I found the thing that broke the app.