[TYPO3-mvc] temporary set does db update?

Stephan Schuler Stephan.Schuler at netlogix.de
Wed Dec 14 10:18:24 CET 2011


Hi Ralph.


I think one can argue about this being a planned behavior or not. The current state: It is.
The persistence is thought as fully transparent. This means: You should not have to think about a save button or a "writeToDatabase" method, everything goes by some kind of magic.

I would suggest to adjust your model. Add a "getDisplayTitle" method that uses the existing "getTitle" and "getTitleNav" methods.

But: Why is your shortTitle not called shortTitle but titleNav? It's totally up to you, and if you are fine with it, keep it. But I would recommend using getShortTitle instead of getTitleNav.

Your getter is rather easy:

public function getDisplayTitle() {
        return $this->getShortTitle() ?: $this->getTitle();
}


Regards,
Stephan.



Stephan Schuler
Web-Entwickler

Telefon: +49 (911) 539909 - 0
E-Mail: Stephan.Schuler at netlogix.de
Website: media.netlogix.de


--
netlogix GmbH & Co. KG
IT-Services | IT-Training | Media
Andernacher Straße 53 | 90411 Nürnberg
Telefon: +49 (911) 539909 - 0 | Fax: +49 (911) 539909 - 99
E-Mail: info at netlogix.de | Internet: http://www.netlogix.de

netlogix GmbH & Co. KG ist eingetragen am Amtsgericht Nürnberg (HRA 13338)
Persönlich haftende Gesellschafterin: netlogix Verwaltungs GmbH (HRB 20634)
Umsatzsteuer-Identifikationsnummer: DE 233472254
Geschäftsführer: Stefan Buchta, Matthias Schmidt



-----Ursprüngliche Nachricht-----
Von: typo3-project-typo3v4mvc-bounces at lists.typo3.org [mailto:typo3-project-typo3v4mvc-bounces at lists.typo3.org] Im Auftrag von Ralph Germershausen
Gesendet: Mittwoch, 14. Dezember 2011 09:54
An: typo3-project-typo3v4mvc at lists.typo3.org
Betreff: [TYPO3-mvc] temporary set does db update?

hi there. i try to fill a select with db objects.

<f:form.select name="spublisher" options="{publisherSelect}"
optionValueField="uid" optionLabelField="title" class="style2"
value="{piVars.spublisher}"/>

my problem is that there is a title and shorttitle so i try to set shorttitle for title if there is one.
BUT.. this change make his way into the db. i am in a list view.
no update actions. this is the second time i ran into problems with set.
is this a wished behaviour and i am doind something wrong or is a bug?

$publisher = $this->publisherRepository->findAllOrdered();
//prepare shorttitle
$publisherArr = array();
foreach($publisher->toArray() as $key => $value) {
    if(trim($value->getTitlenav()) != '') {
          $value->setTitle($value->getTitlenav());
     }
     array_push($publisherArr, $value);
 }
_______________________________________________
TYPO3-project-typo3v4mvc mailing list
TYPO3-project-typo3v4mvc at lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc


More information about the TYPO3-project-typo3v4mvc mailing list