Pascals Blog
navigation
Tag cloud
Code and project management with InDefero

A few weeks ago I was in the situation that most developers will know. You changed something in your code and suddenly - or worse, after a few other changes - everything is screwed up and you end up debugging your application, searching for this one tiny typo.
So, once again, I started thinking of setting up a version controll system. Thinking again, I recognized why all my other CVS or Subversion installations ended with one or two repositories, unused: It's the overhead. You have to set up, update and manage the version control software itself, deal with new users and check permissions now and then. Also, if you want things to be secure, you should use ssh for transport of your source, so you have to deal with all the public keys of your clients (or co-workers).
So I talked to Patrick at the agency for that I do lots of work and ask him which version control system he would prefer. He immediately answered "git". But even with distributed repositories, you want a "public" or central place where all the work comes together. You also want to keep meta information, such as tickets, documentation, downloads, ... at one place where everyone could easily find it.
You want github or Google Code. But having all your (closed) source hosted on Google is maybe not such a good idea. Long story short: the solution is a Google Code you can host yourself: InDefero.
InDefero has an incredibly clean layout and is thus powerful. It handles git, svn and hg repositories, which means that it creates them for you, tracks changes (and commit messages) and manages access via ssh. You, as a user, simply upload your ssh public key and start working. It also integrates a Wiki, a download center, an overview, code review and very easy and also fast admin panel. And I could go on.
As you might have noticed I'm pretty happy with InDefero and all my clients seem excited, not only because there are no more endles email threads about just one issue, but also they can see the progress of the project with one click.
Nested Objects with FLUID
A few days ago someone on the #TYPO3 IRC channel on Freenode had a problem submitting nested objects within his exbtase extension.
Imagine the following: you have a shopping cart object holding some items from the shop. Now the customer submits his order and changes the number of items he wants to buy. You obviously wouldn't want to click on the item first, change it's quantity, save that and then submit the shopping cart. The solution is to nest the objects and submit them.
So we fiddled a bit and came to a solution which is even quiet simple. Thomas was nice enough to share the solution on the mailing list. Unfortunately FLUID doesn't generate the correct form, so you have to do it yourself:
<f:form name="object" object="{object}" action="update">
<f:for each="{object.subObjects}" as="subObject">
<f:form.textbox name="subObjects[{subObject.uid}][title]"
value="{subObject.title}"/>
<f:form.hidden name="subObjects[{subObject.uid}][__identity]"
value="{subObject.uid}"/>
</f:for>
</f:form>
The basic point here is simply to provide the __identity property so that extbase is able to map the incomming object correctly. But there is one more problem: FLUID prevents you for security reasons to modify properties of objects which where not editable in the form. And as FLUID doesn't generate the above form, it would throw an error. So we have to disable this check. Please note that you should really know what you are doing, when disabling it.
/**
* Update
*
* @dontverifyrequesthash
* @param Tx_EXT_Domain_Model_Object $object
* @param array $subObjects
* @return void
*/
public function updateAction(
Tx_EXT_Domain_Model_Object $object,
array $subObjects) {
$this->propertyMapper->map(
array('subObjects'), array('subObjects' => $subObjects),
$object
);
}
The important parts here are the @dontverifyrequesthash which disables the hash checking for the reason I pointed out above. The map(); function automatically persists the changes an you're done.
Welcome
Welcome to my blog. If I find time, I'm going to blog about things that happen to me at work and maybe random other stuff.
The focus will be on extbase and FLUID extension developmet, but I will also publish useful ViewHelpers and snippets.
If you have any suggestions, please leave a comment or write me a mail. I'd really appreciate it.
Latest Posts
- Code and project management with InDefero
- 18.01.2010 01:59
- Nested Objects with FLUID
- 17.01.2010 17:39
- Welcome
- 16.01.2010 20:00
Categories
- Development(1)
- Stuff(1)
- [-]TYPO3(2)
- Extbase(1)
- [-]FLUID(1)
- Viewhelper(0)