How does teh Class GridFieldConfig_RelationEditor in SIlverstripe work with data relations. Why do one need it?
It doesn't work with data relations directly. It's just a shortcut for configuring your gridfield for managing and editing relations of your gridfield. A quick look at the code might shed some light on it. The config items it adds are pretty self explanatory. You might also consult the API Docs for another explantion what this class does for you.
Understanding how the gridfield works is a bit hard in the beginning, but it's very modular and powerful. Out of the box it does pretty nothing but you can do a lot with it when you know how to configure it.
You use the GridFieldConfig_RelationEditor to configure your GridFields. The default configuration for a GridField is using a GridField_RecordEditor configuration... which means, by default you only have the option to edit existing data object (DOs displayed in the GridField). If you switch to the GridFieldConfig_RelationEditor configuration, you'll be able to link already existing data objects to the GridField, or unlink linked DOs in the GridField.
Related
I'm new to Symfony2 and would like to know the proper place to put my universal helper class. The helper class contains things like removeCurseWords, uplodFile, resizeImage, watermarkImage, convertDateToServerTime, doStuffHere and other things used by many but belong to none. I want this class to be accessible to all the bundles in my app so where do I place it to make it available to all.
Group those methods and put them in services (see http://symfony.com/doc/current/book/service_container.html). That way you can use them cross-bundle via the service container. You could have one service for all image operations and one for the rest which doesn't fit elsewhere.
If you have your php Library i suggest you to write a bundle that wrap it for symfony2 usage for, as example, expose the functionality as services container, manage the initialization, implement for type and so on for enable your library in yhe symfony2 way, then you can share via composer in other projects.
See this for further details.
Hope this help
I always create a folder called "Utils" at the same level as Controllers, Repositories, etc Found several people doing it that way too.
We need to customize for example the standard mail invitation template by changing the text a bit. I know this can be done by editing the freemarker template for the invitation that is stored in the data dictionary. This is however not optimal when it comes to application packaging. Is it somehow possible to extend the templates in the manner that they could be put on the extension classpath like the regular extension mechanism?
edit:
Found out that the inviation template for emails are hardcoded in the InviteSender java-class. :(
So I guess we will have to extend that class (and a lot of others) to do this.
Another solution I can think of would be to write a patch that replaces the ftl-files in the data dictionary with our edited ones at install time. Any other ideas?
It has been done and has been written in this blog.
In short No there is no out of the box solution for it.
Yes you could bootstrap your files and Patch Alfresco's (that's the most common used way).
You should also consider the fact that changing a template without to have access to the server where Alfresco is installed is a nice feature. With this functional guys who manage/operate/use Alfresco can change templates to their needs.
I have a specific theme which I apply to my html and now instead of editing it everything I create view. I want to edit the html helper methods and all all my necessary classes and id information can be put in one place.
How do i do this?
Do I just create a new custom one or is it easier to edit one that is already there? I do plan to add some ones that are not there.
I have googled abit but all the answerers I found give specific code to their problem. I dont even know which folder to put my classes in? In a book im reading about mvc it explains custom model template, but i dont think that is exactly what im looking for?
Even a basic example will be great.
Do I just create a new custom one or is it easier to edit one that is
already there? I do plan to add some ones that are not there.
I would say creating a custom one would be fast and simple. But if you still want to give a try by enhancing existing one, than you can get the source code of System.Web.Mvc for CodePlex, and make your necessary modifications and build it, reference it and use it in your project.
I am developing a quit simple website, with just some text. The text need to be editable by the user, so I am storing the text in a database. Because of that, i need to access to my Doctrine entity from every bundle, so where do I need to write that entity ?
Thank you
All your entities are accesible across your app if you you use namespaces.
Just create it, for example, at Your\WhateverBundle\Entity\Myentity and in every controller you must add: use Your\WhateverBundle\Entity\Myentity;
I think that's you are looking for, isn't it?
So my problem is exactly the same as this guy's here: http://www.pubbs.net/201003/flex/61462-flexcoders-flash-builder-super-class-regeneration.html , but unfortunately, he got no answer.
After initially generating service classes connecting with PHP, I modified the PHP, added new call specifically.
While the Data/Services window successfully made notice of the changes, including new function in the list, the service super-class didn't change whatsoever. Which baffles me, since all super-classes in generated service and valueObject packages contain an annotation like this:
This is a generated class and is not intended for modification. To customize behavior
of this service wrapper you may modify the generated sub-class of this class - SomethingService.as.
And also the sub-class contains something about "regeneration of the super-class". So obviously, my goal is to force the mentioned regeneration. Any thoughts?
Just had a similar problem and it was driving me nuts. In my case, I am using an Eclipse plug-in for Team Foundation Server (a source control repository). In TFS, files are kept read-only until you check them out. Usually when something behind the scenes tries to modify a file that I have open, the plug-in will check out the file automatically and let it make the changes. For some reason, it didn't in this case.
So for me, all I had to do was check out the file and it would then be able to regenerate (which translates to making the file writable for the rest of you who might have the same issue).
I find that most code generators work once to generate classes, but do not work well updating them. It's really hard (I've worked on them).
Can you correct your classes by hand?