Informatik (Fach) / Alles zum TYPO3 Flow Framework (Lektion)

In dieser Lektion befinden sich 21 Karteikarten

Beschreibung der einzelnen Bestandteile des Frameworks und was man im Rahmen der Entwicklung wissen sollte.

Diese Lektion wurde von kartenchris erstellt.

Lektion lernen

  • Konfiguration der Injektion ------------------------------------ Was muss man beachten, wenn man in TYPO3 Flow einen Wert, ein Objekt oder ein Setting injiziert? If you want to inject an object, the injection configuration is done automatically by the autowiring capabilities of the Object Builder.If you want to inject a straight value or settings, you have to edit/provide some explicit configuration.
  • Was beschreibt die Variable "$setting" im Bereich der Dependency Injection? Sie beschreibt einen Pfad in einem der settings.yaml-files. Der Pfad ist durch Punkte getrennt.
  • a) Welche Faust-Regel schlagen die TYPO3 Flow-Entwickler vor, wenn es um die Benennung der Methoden bei Setter Injection geht? b) Welchen Vorteil hat "inject" gegenüber "set"? zu a) - Benötigte Properties haben Prefix "inject".- Optionale Properties haben Prefix "set". zu b) Methoden mit dem Prefix "inject" können dank der Autowiring-Fähigkeiten des Object Builders die benötigten Abhängigkeiten des injizierten Objekts auflösen und diese konfigurieren.
  • Was unterscheidet das Konfigurationsfile von Constructor Injection und Setter Injection? "arguments" statt "properties" eine Zahl statt dem Namen der Property.
  • - Wozu benötigt man "Statische Methoden-Kompilierung"? - Wann wird sie angewendet? - Welche Vorraussetzung muss die Methode erfüllen? - Wie erstellt man diese? - In welchem Kontext hat diese lediglich Wirkung? - Was ist wichtig zu beachten für d - Zur Performance-Verbesserung. - Wenn man vermeiden will, dass statische Daten erst zur Laufzeit generiert werden.  - Die von der Methode generierten Daten müssen schon zur Kompilierzeit bekannt sein und während der Laufzeit statisch bleiben. - Man erstellt diese, indem man die Methode statisch deklariert, ihr einen Parameter $objectManager ohne Type-Hint übergibt und sie mit "@Flow\CompileStatic" annotiert. - Nur im Produktions-Kontext, ansonsten wird die Methode während der Laufzeit aufgerufen. - Das Argument darf keinen Type-Hint enthalten, denn es kann auch vom Typ DependencyProxy sein. Mehr zu DependencyProxy findet man im Abschnitt "Lazy Dependeny Injection" in Kapitel 3.  
  • a) Welche Persistenz-Mechanismen gibt es in Typo3 Flow? b) Welche unterschiedlichen Lade-Typen unterscheiden diese? a) Doctrine2 ORM und Generic Persistence. b) Doctrine2 ORM: lazy loading. Generic Persistence: eager loading.
  • Wie kann man das lazy loading bei Doctrine2 ORM auf eager loading ändern? a) Entweder durch DQL join-Operationen oder durch  b) einstellen des fetch-Mode in der Mapping-Konfiguration.
  • Wo kann man Generic Persistence anwenden? Für eigene Persistenz-Backends in Typo3 Flow.
  • [NL] Was muss man beim Anlegen eines Entity-Objekts beachten? - Eine Entity-Klasse darf nicht final sein oder finale Methoden enthalten - Persistene Eigenschaften sollten immer protected sein und nicht public, ansonsten könnte lazy-loading nicht wie erwartet arbeiten. Implementing __clone() or __wakeup() is not a problem with TYPO3 Flow, as the instances always have an identity. If using your own identity properties, you must wrap any code you intend to run in those methods in an identity check. Entity classes in a class hierarchy that inherit directly or indirectly from one another must not have a mapped property with the same name. Entities cannot use func_get_args() to implement variable parameters. The proxies generated by Doctrine do not support this for performance reasons and your code might actually fail to work when violating this restriction. Persisted instance variables must be accessed only from within the entity instance itself, not by clients of the entity. The state of the entity should be available to clients only through the entity’s methods, i.e. getter/setter methods or other business methods. Collection-valued persistent fields and properties must be defined in terms of the Doctrine\Common\Collections\Collectioninterface. The collection implementation type may be used by the application to initialize fields or properties before the entity is made persistent. Once the entity becomes managed (or detached), subsequent access must happen through the interface type.
  • [NL] Doctrine2-Annotationen in Typo3 Flow             AnnotationScopeMeaning Entity Class Declares a class as an Entity. ValueObject Class Declares a class as a Value Object, allowing the persistence framework to reuse an existing object if one exists. Column Variable Allows to take influence on the column actually generated for this property in the database. Particularly useful with string properties to limit the space used or to enable storage of more than 255 characters. ManyToOne,OneToMany,ManyToMany,OneToOne Variable Defines the type of object associations, refer to the Doctrine 2 documentation for details. The most obvious difference to plain Doctrine 2 is that the targetEntityparameter can be omitted, it is taken from the @var annotation. The cascade attribute is set to cascade all operations on associations within aggregate boundaries. In that case orphanRemoval is turned on as well. @var Variable Is used to detect the type a variable has. For collections, the type is given in angle brackets. Transient Variable Makes the persistence framework ignore the variable. Neither will it's value be persisted, nor will it be touched during reconstitution. Identity Variable Marks the variable as being relevant for determining the identity of an object in the domain. For all class properties marked with this, a (compound) unique index will be created in the database.    
  • [NL]Value Object Handling with Doctrine On Value Object handling with Doctrine Doctrine 2 does not (yet [2]) support value objects, thus we treat them as entities for the time being, with some differences: Value Objects are marked immutable as with the ReadOnly annotation of Doctrine. Unless you override the type using Column Value Objects will be stored as serialized object in the database. Upon persisting Value Objects already present in the underlying database will be deduplicated.
  • Differences between TYPO3 Flow and plain Doctrine http://docs.typo3.org/flow/TYPO3FlowDocumentation/TheDefinitiveGuide/PartIII/Persistence.html#differences-between-typo3-flow-and-plain-doctrine
  • [NL] Registrierung von RequestHandlern Request handlers must first be registered in order to be considered during the resolving phase. Registration is done in thePackage class of the package containing the request handler:   class Package extends BasePackage { public function boot(\TYPO3\Flow\Core\Bootstrap $bootstrap) { $bootstrap->registerRequestHandler(new \Acme\Foo\BarRequestHandler($bootstrap)); } }
  • Die Argum. ein. Requests sind eine Misch. aus d. GET, POST, PUT u. FILES-Variablen. Diese sind jedoch n. geeign. für die Benutz. in den Controller-Actions, da sie n. bereinigt oder weiter verarbeitet wurden.Was soll m. tun, wenn man denn. sie möchte? Man sollte die Funktion getArguments() der Request-Klasse benutzen, um die Argumente zu erhalten. Die Request-Klasse ist TYPO3\Flow\Http\Request. Es gibt aber auch noch andere Retrieval-Methoden, wie z.B. getArgument($name).
  • Was ist wichtig bezüglich HTTP 1.1 im Sinne von Typo3 Flow? Man sollte für Cookies, Requests, Responses, Headers und URIs die von TYPO3 Flow bereitgestellten API-Funktionen benutzen. Dazu zählt auch die Klasse "Message". Deren Methoden sollte man auch benuten. Request und Response erben von ihr.
  • In welchem Ordner liegen die Layouts? In Resources/Private/Layouts des jeweiligen Packages.
  • Wenn ein Domain Model im Controller als Argument benutzt wird: Kommt zuerst die Validierung oder das Property Mapping? Zuerst kommt das Property Mapping, dann die Validierung.
  • Was versteht man unter einer "Route"? Sie ist der Weg vom Browser zum Controller - und zurück.
  • Was bedeutet @ORM\OneToMany(mappedBy="blog") protected $posts: Das bedeutet, dass ein Blog mehrere Posts haben kann.Und mappedBy gibt an, dass die Assoziation bidirektional ist undein Post eine Referenz auf den entsprechenden Blog enthält.
  • Was ist mit "Reflection" gemeint? Unter "Reflection" wird verstanden, dass der Programmierer Daten über das Programm selbst und dessen innereren Teile zur Laufzeit erhält. Außerdem wird darunter die Veränderung von Verhalten und Eigenschaften der am Programm beteiligten Objekte verstanden.
  • Gebe Beispiele für Reflection an! 1. Änderung der Zugriffs-Modifizierer für Eigenschaften und Methoden, bspw. von protected nach public. Dies ist auch möglich, wenn der Zugriff zu ihnen beschränkt ist. 2. Der Programmierer kann herausfinden, welche Argumente eine Methode erwartet und ob diese erforderlich sind oder ob sie optional sind.