Objektorientierte Programmierung mit extbase und fluid

5,545
-1

Published on

Published in: Technology, Education
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
5,545
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Objektorientierte Programmierung mit extbase und fluid

    1. 1. Objektorientierte Programmierung mit extbase und fluid 26.-27.01.2011 Oliver Klee, typo3-coding@oliverklee.de
    2. 2. pibase und extbase sind Frameworks
    3. 3. pibase und extbase sind Frameworks pibase
    4. 4. pibase und extbase sind Frameworks pibase extbase
    5. 5. pibase und extbase sind Frameworks Backport von pibase extbase
    6. 6. pibase „unterstützt“ hauptsächlich prozeduralen Code
    7. 7. pibase „unterstützt“ hauptsächlich prozeduralen Code
    8. 8. tt_news- Hauptklassepibase „unterstützt“ hauptsächlich prozeduralen Code
    9. 9. tt_news- Hauptklassepibase „unterstützt“ hauptsächlich prozeduralen Code
    10. 10. tt_news- Hauptklassepibase „unterstützt“ hauptsächlich prozeduralen Code
    11. 11. tt_news- Hauptklasse > 400 0 Ze i le n …pibase „unterstützt“ hauptsächlich prozeduralen Code
    12. 12. Monster- Klassen
    13. 13. extbase fördert lesbaren, gut wartbaren Code
    14. 14. news2- Hauptklasseextbase fördert lesbaren, gut wartbaren Code
    15. 15. news2- Hauptklasseextbase fördert lesbaren, gut wartbaren Code
    16. 16. news2- Hauptklasse c a . 26 0 Ze i le n …extbase fördert lesbaren, gut wartbaren Code
    17. 17. extbase unterstütztDomain-Driven Design (DDD)
    18. 18. extbase unterstütztDomain-Driven Design (DDD)
    19. 19. class Book { … }extbase unterstütztDomain-Driven Design (DDD)
    20. 20. class Book { … }extbase unterstütztDomain-Driven Design (DDD)
    21. 21. fluid erlaubt mächtige HTML-Templates
    22. 22. fluid erlaubt mächtige HTML-Templates<f:for each="{categories}" as="category"> <table class="overview"> <tr> <td> <h1>{category.title}</h1> </td> <td> <f:image src="{category.image}" width="42"/> </td> </tr> </table></f:for>
    23. 23. … und pibase eher nicht.<!-- ###TEMPLATE_LATEST### begin! This is the template for the latest news, typically displayed on a frontpage--><div class="news-latest-container">! <h2>###LATEST_HEADER###</h2>! <!-- ###CONTENT### begin! ! This is the part of the template substituted with the list of news:! -->! ! <!-- ###NEWS### begin! ! ! Template for a single item! ! -->! ! ! <div class="news-latest-item">! ! ! ! <span class="news-latest-date"><!--###LINK_ITEM###-->###NEWS_DATE### ###NEWS_TIME###<!--###LINK_ITEM###--></span>! ! ! ! <h3><!--###LINK_ITEM###-->###NEWS_TITLE###<!--###LINK_ITEM###--></h3>! ! ! ! <!--###LINK_ITEM###-->###NEWS_IMAGE###<!--###LINK_ITEM###-->! ! ! ! ###NEWS_SUBHEADER###<hr class="clearer" />! ! ! ! ###CATWRAP_B### ###TEXT_CAT_LATEST### ###NEWS_CATEGORY### ###NEWS_CATEGORY_IMAGE######CATWRAP_E### <div class="news-latest-morelink"><!--###LINK_ITEM###-->###MORE###<!--###LINK_ITEM###--></div>! ! ! </div>! ! <!-- ###NEWS### end-->!!! <!-- ###CONTENT### end --><div class="news-latest-gotoarchive"><!--###LINK_ARCHIVE###-->###GOTOARCHIVE###<!--###LINK_ARCHIVE###--></div></div><!-- ###TEMPLATE_LATEST### end -->
    24. 24. extbase macht vieles einfacher
    25. 25. extbase macht vieles einfacher die Entwicklung geht schneller
    26. 26. extbase macht vieles einfacher die Entwicklung geht schneller es ist weniger Code nötig
    27. 27. extbase macht vieles einfacher die Entwicklung geht schneller es ist weniger Code nötig Unit-Tests sind einfacher
    28. 28. extbase macht vieles einfacher die Entwicklung geht schneller es ist weniger Code nötig Unit-Tests sind einfacher HTML-Templates können mehr
    29. 29. extbase macht vieles einfacher die Entwicklung geht schneller es ist weniger Code nötig Unit-Tests sind einfacher HTML-Templates können mehr Einarbeitungszeit für neues Framework
    30. 30. Wilde extbase-/fluid-Fragestunde
    31. 31. OOP-Vokabular auf einen Blick
    32. 32. OOP-Vokabular auf einen Blickpublic class Book { /** @var string */ protected $title = ; /** @var Author */ protected $author = NULL; public function __construct() { $this->title = (no title); } public function __destruct() { $this->author = NULL; } public function setAuthor(Author $author) { $this->author = $author; } public function getAuthor() { return $this->author; }…
    33. 33. OOP-Vokabular auf einen Blick Klassepublic class Book { /** @var string */ protected $title = ; /** @var Author */ protected $author = NULL; public function __construct() { $this->title = (no title); } public function __destruct() { $this->author = NULL; } public function setAuthor(Author $author) { $this->author = $author; } public function getAuthor() { return $this->author; }…
    34. 34. OOP-Vokabular auf einen Blick Klassepublic class Book { Feld, Membervariable /** @var string */ protected $title = ; /** @var Author */ protected $author = NULL; public function __construct() { $this->title = (no title); } public function __destruct() { $this->author = NULL; } public function setAuthor(Author $author) { $this->author = $author; } public function getAuthor() { return $this->author; }…
    35. 35. OOP-Vokabular auf einen Blick Klasse public class Book { Feld, Membervariable /** @var string */ protected $title = ; /** @var Author */ protected $author = NULL; public function __construct() {Methoden, Memberfunktionen $this->title = (no title); } public function __destruct() { $this->author = NULL; } public function setAuthor(Author $author) { $this->author = $author; } public function getAuthor() { return $this->author; } …
    36. 36. OOP-Vokabular auf einen Blick Klasse public class Book { Feld, Membervariable /** @var string */ protected $title = ; /** @var Author */ protected $author = NULL; Konstruktor public function __construct() {Methoden, Memberfunktionen $this->title = (no title); } public function __destruct() { $this->author = NULL; } public function setAuthor(Author $author) { $this->author = $author; } public function getAuthor() { return $this->author; } …
    37. 37. OOP-Vokabular auf einen Blick Klasse public class Book { Feld, Membervariable /** @var string */ protected $title = ; /** @var Author */ protected $author = NULL; Konstruktor public function __construct() {Methoden, Memberfunktionen $this->title = (no title); } Destruktor public function __destruct() { $this->author = NULL; } public function setAuthor(Author $author) { $this->author = $author; } public function getAuthor() { return $this->author; } …
    38. 38. OOP-Vokabular auf einen Blick Klasse public class Book { Feld, Membervariable /** @var string */ protected $title = ; /** @var Author */ protected $author = NULL; Konstruktor public function __construct() {Methoden, Memberfunktionen $this->title = (no title); } Destruktor public function __destruct() { $this->author = NULL; } public function setAuthor(Author $author) { $this->author = $author; } public function getAuthor() { return $this->author; } Getter …
    39. 39. OOP-Vokabular auf einen Blick Klasse public class Book { Feld, Membervariable /** @var string */ protected $title = ; /** @var Author */ protected $author = NULL; Konstruktor public function __construct() {Methoden, Memberfunktionen $this->title = (no title); } Destruktor public function __destruct() { $this->author = NULL; } public function setAuthor(Author $author) { $this->author = $author; } Setter public function getAuthor() { return $this->author; } Getter …
    40. 40. OOP-Vokabular auf einen Blick Klasse public class Book { Feld, Membervariable /** @var string */ protected $title = ; /** @var Author */ protected $author = NULL; Konstruktor public function __construct() {Methoden, Memberfunktionen $this->title = (no title); } Destruktor public function __destruct() { $this->author = NULL; } public function setAuthor(Author $author) { $this->author = $author; } Setter Daten- public function getAuthor() { kapselung return $this->author; } Getter …
    41. 41. OOP-Vokabular auf einen Blick Klasse public class Book { Feld, Membervariable /** @var string */ protected $title = ; /** @var Author */ protected $author = NULL; Konstruktor public function __construct() {Methoden, Memberfunktionen $this->title = (no title); } Destruktor public function __destruct() { $this->author = NULL; Type-Hinting } public function setAuthor(Author $author) { $this->author = $author; } Setter Daten- public function getAuthor() { kapselung return $this->author; } Getter …
    42. 42. OOP-Vokabular auf einen Blick Klasse public class Book { Feld, Membervariable /** @var string */ protected $title = ; $book = new Book(); /** @var Author */ protected $author = NULL; Konstruktor public function __construct() {Methoden, Memberfunktionen $this->title = (no title); } Destruktor public function __destruct() { $this->author = NULL; Type-Hinting } public function setAuthor(Author $author) { $this->author = $author; } Setter Daten- public function getAuthor() { kapselung return $this->author; } Getter …
    43. 43. OOP-Vokabular auf einen Blick Klasse public class Book { Feld, Membervariable /** @var string */ protected $title = ; $book = new Book(); /** @var Author */ protected $author = NULL; Konstruktor Book-Instanz, public function __construct() { Referenz aufMethoden, Memberfunktionen $this->title = (no title); Objekt } Destruktor public function __destruct() { $this->author = NULL; Type-Hinting } public function setAuthor(Author $author) { $this->author = $author; } Setter Daten- public function getAuthor() { kapselung return $this->author; } Getter …
    44. 44. Vererbung erlaubt Code-Reuse
    45. 45. Vererbung erlaubt Code-Reuse BookPaperback Hardcover
    46. 46. Vererbung erlaubt Code-Reuse class Book { … public function getTitle() { return $this->title(); } public function setTitle($title) { $this->title = $title; } } BookPaperback Hardcover
    47. 47. Vererbung erlaubt Code-Reuse class Book { … public function getTitle() { return $this->title(); } public function setTitle($title) { $this->title = $title; } } class Paperback extends Book { Book } …Paperback Hardcover
    48. 48. Vererbung erlaubt Code-Reuse class Book { … public function getTitle() { return $this->title(); } public function setTitle($title) { $this->title = $title; } } class Paperback extends Book { Book } … class Hardcover extends Book { … }Paperback Hardcover
    49. 49. Vererbung erlaubt Code-Reuse class Book { … public function getTitle() { return $this->title(); } public function setTitle($title) { $this->title = $title; } } class Paperback extends Book { Book } … class Hardcover extends Book { … }Paperback Hardcover extends = „ist ein“
    50. 50. Polymorphismus(Wer ein Buch bestellt, bekomme manchmal auch einTaschenbuch oder ein gebundenes Buch geliefert.)
    51. 51. Polymorphismus(Wer ein Buch bestellt, bekomme manchmal auch einTaschenbuch oder ein gebundenes Buch geliefert.)class Bookshelf { … public function addBook(Book $book) { … } …}
    52. 52. Polymorphismus(Wer ein Buch bestellt, bekomme manchmal auch einTaschenbuch oder ein gebundenes Buch geliefert.)class Bookshelf { … public function addBook(Book $book) { … } …} $ivar = new Bookshelf(); $domainDrivenDevelopment = new Book(); $ivar->addBook($domainDrivenDevelopment); $harryPotterVolumeOne = new Paperback(); $ivar->addBook($harryPotterVolumeOne); $lordOfTheRings = new Hardcover(); $ivar->addBook($lordOfTheRings);
    53. 53. Interfaces definieren die nötigen Methoden
    54. 54. Interfaces definieren die nötigen Methoden Readable Book
    55. 55. Interfaces definieren die nötigen Methoden interface Readable { Readable } public function turnPage(); Book
    56. 56. Interfaces definieren die nötigen Methoden interface Readable { Readable } public function turnPage(); class Book implements Readable { Book … public function turnPage() { $this->currentPageNumber += 2; } }
    57. 57. Interfaces definieren die nötigen Methoden interface Readable { Readable } public function turnPage(); implements = „kann auch“ class Book implements Readable { Book … public function turnPage() { $this->currentPageNumber += 2; } }
    58. 58. 1x erben, 1000x implementieren
    59. 59. 1x erben, 1000x implementieren Book
    60. 60. 1x erben, 1000x implementieren Publication Book
    61. 61. 1x erben, 1000x implementieren Readable Publication Book
    62. 62. 1x erben, 1000x implementieren Readable Soakable Publication Book
    63. 63. 1x erben, 1000x implementieren Readable Soakable Publication Book class Book extends Publication implements Readable, Soakable { … }
    64. 64. Model,View, Controller (MVC)
    65. 65. Model,View, Controller (MVC)
    66. 66. Model,View, Controller (MVC) Controller bringt alles zusammen
    67. 67. Model,View, Controller (MVC) Controller Model(s) bringt alles zusammen enthalten die Daten
    68. 68. Model,View, Controller (MVC) Controller Model(s) bringt alles zusammen enthalten die Daten
    69. 69. Model,View, Controller (MVC) Controller Model(s) bringt alles zusammen enthalten die Daten View erzeugt die Ausgabe
    70. 70. Model,View, Controller (MVC) Controller Model(s) bringt alles zusammen enthalten die Daten View erzeugt die Ausgabe
    71. 71. Controller in extbase
    72. 72. Controller in extbase NewsController
    73. 73. Controller in extbase NewsController ImportController
    74. 74. Controller in extbase NewsController ImportController 1 Controller pro Plugin oder BE-Modul
    75. 75. Controller in extbase NewsController ImportController listAction 1 Controller pro Plugin oder BE-Modul
    76. 76. Controller in extbase NewsController ImportController listAction 1 Controller pro Plugin showAction oder BE-Modul
    77. 77. Controller in extbase NewsController ImportController listAction 1 Controller pro Plugin showAction oder BE-Modul editAction
    78. 78. Debugging in fluid<p>{bookshelves}</p><f:debug>{bookshelf}</f:debug><f:debug title=“key“>{key}</f:debug>
    79. 79. Formular zum Bearbeiten
    80. 80. Formular zum Bearbeiten<f:link.action action="edit"arguments="{bookshelf : bookshelf}">Edit</f:link.action>
    81. 81. Formular zum Bearbeiten<f:link.action action="edit"arguments="{bookshelf : bookshelf}">Edit</f:link.action>class Tx_Bookshelf_Controller_BookshelfController { /**! * @param Tx_Bookshelf_Domain_Model_Bookshelf$bookshelf the Bookshelf to display! */! public function editAction( Tx_Bookshelf_Domain_Model_Bookshelf $bookshelf ) {! ! $this->view->assign(bookshelf, $bookshelf);! }
    82. 82. Formular zum Bearbeiten /**! * @param Tx_Bookshelf_Domain_Model_Bookshelf$bookshelf the Bookshelf to display! */! public function updateAction( Tx_Bookshelf_Domain_Model_Bookshelf $bookshelf ) {! ! $this->bookshelfRepository->update($bookshelf);! ! $this->flashMessageContainer ->add(Your Bookshelf was updated.);! ! $this->redirect(list);! }
    83. 83. Formular zum Bearbeiten<f:layout name="default" /> Bookshelf/<f:section name="main"> Edit.html…<f:form method="post" action="update" name="bookshelf" object="{bookshelf}"> <f:render partial="Bookshelf/formFields" />! <f:form.submit value="Save" /></f:form></f:section>
    84. 84. Formular zum Bearbeiten<f:layout name="default" /> Bookshelf/<f:section name="main"> Edit.html…<f:form method="post" action="update" name="bookshelf" object="{bookshelf}"> <f:render partial="Bookshelf/formFields" />! <f:form.submit value="Save" /></f:form></f:section> Bookshelf/ Update.html fehlt …
    85. 85. Formular zum Bearbeiten Partials/ Bookshelf/ <label for="title"> <f:translate key="…" /> formFields.html </label><br /> <f:form.textbox property="brand" /><br /> <label …></label><br /> <f:form.textbox property="height" /><br /> <label …></label><br /> <f:form.textbox property="width" /><br />
    86. 86. Formular zum Anlegen
    87. 87. Formular zum Anlegen<f:link.action action="new">New Bookshelf</f:link.action>
    88. 88. Formular zum Anlegen<f:link.action action="new">New Bookshelf</f:link.action>class Tx_Bookshelf_Controller_BookshelfController {! /**! * @param Tx_Bookshelf_Domain_Model_Bookshelf $newBookshelf! * @dontvalidate $newBookshelf! */! public function newAction( Tx_Bookshelf_Domain_Model_Bookshelf $newBookshelf = NULL ) {! ! $this->view->assign(newBookshelf, $newBookshelf);! }
    89. 89. Formular zum Anlegen! /**! * @param Tx_Bookshelf_Domain_Model_Bookshelf $newBookshelf! */! public function createAction( Tx_Bookshelf_Domain_Model_Bookshelf $newBookshelf ) {! ! $this->bookshelfRepository->add($newBookshelf);! ! $this->flashMessageContainer ->add(Your new Bookshelf was created.);! ! $this->redirect(list);! }
    90. 90. Formular zum Anlegen Bookshelf/<f:layout name="default" /> New.html<f:section name="main"><f:form method="post" action="create" name="newBookshelf"object="{newBookshelf}"><f:render partial="Bookshelf/formFields"arguments="{domainObject:domainObject}" /><f:form.submit value="Create new" /></f:form></f:section>
    91. 91. Formular zum Anlegen Bookshelf/<f:layout name="default" /> New.html<f:section name="main"><f:form method="post" action="create" name="newBookshelf"object="{newBookshelf}"><f:render partial="Bookshelf/formFields"arguments="{domainObject:domainObject}" /><f:form.submit value="Create new" /> Bookshelf/</f:form></f:section> Create.html fehlt …
    92. 92. Link zum Löschen
    93. 93. Link zum Löschen<f:link.action action="delete"arguments="{bookshelf : bookshelf}">Delete</f:link.action>
    94. 94. Link zum Löschen<f:link.action action="delete"arguments="{bookshelf : bookshelf}">Delete</f:link.action>class Tx_Bookshelf_Controller_BookshelfController {! /**! * @param Tx_Bookshelf_Domain_Model_Bookshelf$bookshelf the Bookshelf to be deleted! */! public function deleteAction( Tx_Bookshelf_Domain_Model_Bookshelf $bookshelf ) {! ! $this->bookshelfRepository->remove($bookshelf);! ! $this->flashMessageContainer ->add(Your Bookshelf was removed.);! ! $this->redirect(list);! }
    95. 95. Validierung steht imModel
    96. 96. Validierung steht imModelclass Tx_Bookshelf_Domain_Model_Book {! /**! * @var string $title! * @validate NotEmpty! */! protected $title;
    97. 97. Validierung steht imModel Tipp: Cache leeren!class Tx_Bookshelf_Domain_Model_Book {! /**! * @var string $title! * @validate NotEmpty! */! protected $title;
    98. 98. RepositoriesDependency Injection Singletons
    99. 99. „Es kann nureinen geben“
    100. 100. „Es kann nureinen geben“Singleton
    101. 101. „Es kann nureinen geben“ Interface t3lib_SingletonSingleton
    102. 102. Injection
    103. 103. Dependency Injection
    104. 104. Dependency Injectionclass Tx_Bookshelf_Controller_BookshelfController {! /**! * @param Tx_Bookshelf_Domain_Repository_BookshelfRepository $repository! */! public function injectBookshelfRepository( Tx_Bookshelf_Domain_Repository_BookshelfRepository $repository ) {! ! $this->bookshelfRepository = $repository! }
    105. 105. Hollywood-Prinzip: „Don‘t call us … we‘ll call you.“ Dependency Injectionclass Tx_Bookshelf_Controller_BookshelfController {! /**! * @param Tx_Bookshelf_Domain_Repository_BookshelfRepository $repository! */! public function injectBookshelfRepository( Tx_Bookshelf_Domain_Repository_BookshelfRepository $repository ) {! ! $this->bookshelfRepository = $repository! }
    106. 106. Repositories bringen einiges mit
    107. 107. Repositories bringen einiges mitfindByUid($uid) findOneByUid($uid)
    108. 108. Repositories bringen einiges mitfindByUid($uid) findOneByUid($uid) findAll()
    109. 109. Repositories bringen einiges mitfindByUid($uid) findOneByUid($uid) findAll()findBy*($value)findByName($name)findByStatus($status)
    110. 110. Repositories bringen einiges mitfindByUid($uid) findOneByUid($uid) findAll()findBy*($value)findByName($name)findByStatus($status)findOneBy*($value)findOneByName($name)findOneByIsbn($isbn)
    111. 111. Repositories bringen einiges mitfindByUid($uid) findOneByUid($uid) findAll()findBy*($value)findByName($name)findByStatus($status)findOneBy*($value)findOneByName($name)findOneByIsbn($isbn)countBy($value)countByBrand($brand)countByStatus($status)
    112. 112. Queries in Repositories benutzen! /**! * @param integer $serviceUid the service UID! * @param string $mobileNumber the mobile number! *! * @return Tx_Extbase_Persistence_QueryResult result! */! public function findByMobileApplication( $serviceUid, $mobileNumber ) {! ! $query = $this->createQuery();! ! $query->matching($query->logicalAnd(! ! ! $query->equals(service, $serviceUid),! ! ! $query->equals(mobile, $mobileNumber)! ! ));! ! return $query->execute();! }
    113. 113. Queries in Repositories benutzen! /**! * @param integer $serviceUid the service UID! * @param string $mobileNumber the mobile number! *! * @return Tx_Foo_Domain_Model_Thing the query result! */! public function findOneByMobileApplication(! ! $serviceUid, $mobileNumber! ) {! ! $query = $this->createQuery();! ! $query->matching($query->logicalAnd(! ! ! $query->equals(service, $serviceUid),! ! ! $query->equals(mobile, $mobileNumber)! ! ));! ! return $query->execute()->getFirst();! }
    114. 114. Queries in Repositories benutzen! /**! * @param string $phrase! *! * @return Tx_Extbase_Persistence_QueryResult result! */! public function findBySearchPhrase($phrase) {! ! $query = $this->createQuery();! ! $query->matching($query->like( title, % . $phrase . % ));! ! return $query->execute();! }
    115. 115. Sortierung
    116. 116. Sortierung$query = $this->createQuery();$query->setOrderings( array( title => Tx_Extbase_Persistence_QueryInterface::ORDER_ASCENDING, ));
    117. 117. Query-Optionen setzen
    118. 118. Query-Optionen setzen$query = $this->createQuery();$query->getQuerySettings()->setRespectStoragePage(FALSE);
    119. 119. Query-Optionen setzen$query = $this->createQuery();$query->getQuerySettings()->setRespectStoragePage(FALSE);$query = $this->createQuery();$query->getQuerySettings()->setEnableFields(FALSE);
    120. 120. Query-Optionen setzen$query = $this->createQuery();$query->getQuerySettings()->setRespectStoragePage(FALSE);$query = $this->createQuery();$query->getQuerySettings()->setEnableFields(FALSE);public function initializeObject() {! $querySettings = $this->objectManager ->create(Tx_Extbase_Persistence_Typo3QuerySettings);! $querySettings->setRespectStoragePage(FALSE);! $this->setDefaultQuerySettings($querySettings);}
    121. 121. ViewHelper erstellen
    122. 122. ViewHelper erstellen HTML-Template oder Partial {namespace bs=Tx_Bookshelf_ViewHelpers} <bs:onClick src="{book.image}" />
    123. 123. ViewHelper erstellen HTML-Template oder Partial {namespace bs=Tx_Bookshelf_ViewHelpers} <bs:onClick src="{book.image}" />
    124. 124. ViewHelper erstellen HTML-Template oder Partial {namespace bs=Tx_Bookshelf_ViewHelpers} <bs:onClick src="{book.image}" />
    125. 125. ViewHelper erstellen HTML-Template oder Partial {namespace bs=Tx_Bookshelf_ViewHelpers} <bs:onClick src="{book.image}" />class Tx_Bookshelf_ViewHelpers_OnClickViewHelper extendsTx_Fluid_Core_ViewHelper_AbstractViewHelper {! /**! * @param string $src! * @return string! */! public function render($src) { … }
    126. 126. ViewHelper mit Inhalt{namespace bs=Tx_Bookshelf_ViewHelpers}<bs:acronym>Der RTE in TYPO3 arbeitetmit ExtJS.</bs:acronym> HTML-Template oder Partial
    127. 127. ViewHelper mit Inhalt{namespace bs=Tx_Bookshelf_ViewHelpers}<bs:acronym>Der RTE in TYPO3 arbeitetmit ExtJS.</bs:acronym> HTML-Template oder Partialclass Tx_Bookshelf_ViewHelpers_AcronymViewHelper extendsTx_Fluid_Core_ViewHelper_AbstractViewHelper {! /**! * @return string! */! public function render() { $innerContent = $this->renderChildren(); … }
    128. 128. Validatorenclass Tx_Bookshelf_Domain_Model_Book {! /**! * @var string $title! * @validate StringLength(minimum=5, maximum=99)! */! protected $title;
    129. 129. Validatorenclass Tx_Bookshelf_Domain_Model_Book {! /**! * @var string $title! * @validate Tx_Bookshelf_Domain_Validator_TitleValidator! */! protected $title;
    130. 130. Validatorenclass Tx_Bookshelf_Domain_Model_Book { Tx_Bookshelf_Domain_Validator_TitleValidator! /** extends Tx_Extbase_Validation_Validator_AbstractValidator {! /**@var string $title *! * @validate Tx_Bookshelf_Domain_Validator_TitleValidator @param string $value! * */@return boolean! protected $title; */! public function isValid($value) {! ! if (…) {! ! ! $this->addError(! ! ! ! The title must not contain any palindromes.,! ! ! ! 1290592925! ! ! );! ! ! return FALSE;! ! }! ! …! }
    131. 131. Validatorenclass Tx_Bookshelf_Domain_Validator_BookValidator! extends Tx_Extbase_Validation_Validator_AbstractValidator {! /**! * @param Tx_Extbase_Model_Book $value! * @return boolean! */! public function isValid($value) {! ! if (…) {! ! ! $this->addError(! ! ! ! The book must must be yellow.,! ! ! ! 1290592925! ! ! );! ! ! return FALSE;! ! }! ! …! }
    132. 132. Cronjobs und CLIclass Tx_Bookshelf_Service_Cronjob extends tx_scheduler_Task {! /**! * @return boolean always TRUE! */! public function execute() {! ! $GLOBALS[TYPO3_CONF_VARS][EXTCONF][extbase][extensions][Bookshelf][modules][Pi1][controllers]! ! ! = array(Bookshelf => array(actions => array(cron)));! ! $bootstrap = t3lib_div::makeInstance(Tx_Extbase_Core_Bootstrap);! ! $result = $bootstrap->run(! ! ! ,! ! ! array(! ! ! ! extensionName => Bookshelf,! ! ! ! pluginName => Pi1,! ! ! )! ! );! ! return TRUE; }}
    133. 133. Cronjobs und CLIclass Tx_Bookshelf_Service_Cronjob extends tx_scheduler_Task {! /**! * @return boolean always TRUE! */! public function execute() {! ! $GLOBALS[TYPO3_CONF_VARS][EXTCONF][extbase][extensions][Bookshelf][modules][Pi1][controllers]! ! ! = array(Bookshelf => array(actions => array(cron)));! ! $bootstrap = t3lib_div::makeInstance(Tx_Extbase_Core_Bootstrap);! ! $result = $bootstrap->run(! ! ! ,! ! ! array(! ! ! ! extensionName => Bookshelf,! ! ! ! pluginName => Pi1,! ! ! )! ! );! ! return TRUE; kein TS-Setup … }}
    134. 134. AJAX per typenummyAjax = PAGEmyAjax { config … typeNum = 123456 10 = USER_INT 10 { userFunc = tx_extbase_core_bootstrap->run extensionName = Bookshelf pluginName = Pi1 switchableControllerActions { ! ! Bookshelf { ! ! ! 1 = show ! ! } ! } ! persistence =< plugin.tx_bookshelf.persistence ! settings =< plugin. tx_bookshelf.settings }}
    135. 135. AJAX per typenummyAjax = PAGEmyAjax { config … oder per eID typeNum = 123456 10 = USER_INT 10 { userFunc = tx_extbase_core_bootstrap->run extensionName = Bookshelf pluginName = Pi1 switchableControllerActions { ! ! Bookshelf { ! ! ! 1 = show ! ! } ! } ! persistence =< plugin.tx_bookshelf.persistence ! settings =< plugin. tx_bookshelf.settings }}
    136. 136. AJAX per typenummyAjax = PAGEmyAjax { config … oder per eID typeNum = 123456 10 = USER_INT 10 { userFunc = tx_extbase_core_bootstrap->run extensionName = Bookshelf pluginName = Pi1 switchableControllerActions { ! ! Bookshelf { wird demnächst ! ! ! 1 = show besser ! ! } ! } ! persistence =< plugin.tx_bookshelf.persistence ! settings =< plugin. tx_bookshelf.settings }}

    ×