Using yiidocsgenerator extension to generate documentation - documentation

I posted in the Yii forum with no luck. I am hoping someone in this community got this extension working because I really need it!
I used the yiic docs check command, and all the models seem to finally pass the check. So, I proceeded to executing this command:
yiic docs C:\path to my site\protected\models
And at first this appears onscreen:
Building.. : MyApplication Class Reference
Version... : 1.1.7
Source URL:
And then this error pops up:
Building model...
PHP Error[2]:include<GxActiveRecord.php>: failed to open stream: No such file or directory in file C:\path-to-my-app\yii\framework\YiiBase.php at line 396
Where, at that line, I have the following code:
include($className.'.php');
I don't understand why it is looking for a class I do not have!! I found it here, but I don't know in what specific folder that class should reside, or better yet why I should have to download it separately when it's not specified in the instructions. Thanks.

Looks like you've generated models from giix which have GxActiveRecord as a base class and the doc parser does not find this base class, usually you've defined this as an import in your application config, so this may be an expected behavior.
You could try importing something like 'ext.giix.components.GxActiveRecord' in every one of your model classes or copy GxActiveRecord into your models directory just for generating the docs.

Related

Nextcloud in which source file is file uploading handled

I am going to make an app. But i am stuck in one issue. I am unable to find in which file of nextcloud, the codes are available which uploads file.
i want to find the file in which file uploading codes are situated.
I am going to make an app which will make a duplicate of uploaded file and will save in same directory with slightly changed name.
The public API for handling files lives in the \OCP\Files namespace, the implementation is in the \OC\Files namespace (https://github.com/nextcloud/server/tree/master/lib/private/Files).
Rather than modifying this code you should use the hooks functionality (never use classes or functions in the \OC\* namespace!): https://docs.nextcloud.com/server/12/developer_manual/app/hooks.html. This way you can execute your own code when a file is created or updated etc.
I guess you need the postWrite hook. Some sample code (untested):
\OC::$server->getRootFolder()->listen('\OC\Files', 'postWrite', function(\OCP\Files\Node $node) {
$node->copy('my/path');
});

Error when creating a new view using MvcScaffoldingT4TwitterBootstrapMvc Nuget package

I installed the MvcScaffolding4TwitterBootstrapMvc package which is based on the scaffolding stuff Steve Sanderson has done. Now I'm attempting to create a new view based on it and I'm just receiving PS errors.
I'm typing this:
Scaffold View LocationType CreateOrEdit -Template _CreateOrEdit
(I've tried other view templates as well)
I receive this error message:
t4(115,64) : error CS1061: Compiling transformation: 'EnvDTE.CodeProperty' does not contain a definition for 'IsScaffoldable' and no extension method 'IsScaffoldable' accepting a first argument of type 'EnvDTE.CodeProperty' could be found
At packages\MvcScaffolding4TwitterBootstrapMvc.1.0.2\tools\RazorView\MvcScaffolding.RazorView.ps1:42 char:27
Obviously the template is causing the error because it can't find something (maybe the T4 library)? But I'm not really sure what or where I'd fix it.
It looks like the IsScaffoldable extension method doesn't exist in the version of the T4Scaffolding.DLL that is installed with the NuGet package.
If found this work item which lead me to GitHub and I see this method exists. Since I'm not really using this attribute, I decided it's probably just simpler for me to remove the .IsScaffoldable() call from the T4 template instead of pulling down the source and compiling a new version of T4Scaffolding.

Core Data/Mogenerator - No Getters/Setters Created

I'm using Mogenerator to help with my Core Data implementation and for the most part it works great. However, sometimes when I add new attributes, build, and run the project, I get the following error whenever I try to access the property:
[MyObject myAttribute]: unrecognized selector sent to instance
After looking into the machine generated class, it looks like Mogenerator creates getters/setters for some of my new attributes but not ALL of them. What am I doing wrong? How can I still get/set these new attributes when Mogenerator doesn't give me access to these methods?
What I've tried:
1. Synthesizing each new attribute in my Human generated file (this gets rid of the errors at least, but doesn't actually save anything to Core Data)
2. Writing a custom getter/setter for each missing attribute in my Human generated file (same results as above)
Okay, I forgot to follow rule #1 of resolving computer problems... delete and re-install.
I'm using BitBucket to host my repository so I just deleted my local copy and cloned the project back to my machine. It runs fine now. I'm calling this issue "closed" for now, but any thoughts on why this would happen?

Enabling REST on HMVC CodeIgniter setup

I have just finished setting up an HMVC CodeIgniter following the steps here.
I am now trying to create a module "api" which I wish to use Phil Sturgeon's REST library.
It states here that I need to extend the MX_Controller rather than the CI_Controller and I did.
My initial setup was like this
application
--modules
----api
------config
------controller
------libraries
I kept getting an error with loading Rest_Controller so I have tried moving the REST_Controller and Format libraries to application/libraries that seemed to fix the loading issue but now i am getting the error below whenever i try to access it via http://example.com/codeigniter/index.php/api/example/user/id/1/format/json
"An Error Was Encountered
Unable to load the requested class: security"
I am expecting for the output to be "{"id":1,"name":"Some Guy","email":"example1#example.com","fact":"Loves swimming"}"
What am I missing? Would it be possible to keep the REST_Controller and Format libraries under the api module? If so, how?
Source
Open Rest_Controller.php go to line 173 and change the following code
$this->load->library('security');
to
$this->load->helper('security');
EDIT:
To have the REST_Controller and Format libraries under the api module.
Move the REST_Controller to api/controllers/REST_Controller.php and Format to api/libraries/Format.php

How to access views defined with a specific [plone.]browserlayer in test cases

I'm new to testing and I'm trying to create a test for my Plone product for the first time.
I'm on Plone 3.3.
The basic test suite works, I can execute it without errors.
I followed this documentation : http://plone.org/documentation/kb/testing
...except that I'm writing my tests in Python classes instead of doctests.
My problem is that I cannot seem to access the views defined in my app (I get ComponentLookupError).
The problem seems to be with the "browserlayer" defined by my applications.
When I remove the layer="..." attribute from my configure.zcml, the test can access the views without problem. However, if I add it back, it doesn't work.
I guess that's because de browserlayer interface doesn't get applied to the request.
The only reference to this problem I found is in the tests for googlesitemap : http://dev.plone.org/collective/browser/googlesitemap/googlesitemap.common/trunk/googlesitemap/common/tests?rev=
The author seems to have made a custom ZCML file for the test, in which the layer="..." attribute has been removed. (which would work but it seems very bad having to maintain a separate zcml file for the tests)
In my test, I have included the following (taken from the googlesitemap tests), which passes :
from jambette.site.interfaces import IJambetteLayer # this is my browserlayer
from plone.browserlayer.utils import registered_layers
self.assertTrue(IJambetteLayer in registered_layers())
So I think my skin and browserlayer are registered correctly.
Is there anything I need to do so that the browserlayer will be applied to the request?
Browser layer interfaces are simply 'painted' onto the request with directlyProvides. Simply do so in your test setup before you look up the view:
from zope import interface
from jambette.site.interfaces import IJambetteLayer
...
directlyProvides(request, IJambetteLayer)