---
title: "Vorstellung: ARP Creator"
url: "https://www.typo3.net/d/75595-vorstellung-arp-creator"
source: "typo3.net"
tags: ["Extensions","Vorstellung","Info"]
created: "2008-04-03"
last_reply: "2008-04-03"
replies: 0
solved: false
page: 1
pages: 1
lang: "de"
---

# Vorstellung: ARP Creator

Extensions › Vorstellung · 0 Antworten · gestartet 2008-04-03

## Eröffnungsbeitrag

**dyne** · 2008-04-03 · [Beitrag #1](https://www.typo3.net/d/75595-vorstellung-arp-creator/1)

Hi ich möchte meine neue Extension den ARP Creator (arpcreator) vorstellen, der gerade brandneu in der 0.1 Beta-Version im TER zum Download steht.

Der ARP-Creator hat ein Backend-Modul, das die installierten Extensions und deren Tabellen ausliest.
Für "local" installierte Extensions mit einer ordentlichen "tca.php" bietet er die Möglichkeit für jede Ext-Tabelle eine sog. ARP-Klasse zu generieren.
Es wird eine File mit einem Namen wie class.myext_item_arp.php erstellt und die beinhaltete Klasse setzt das "**Active Record Pattern**" für die entsprechende  Tabelle um, so dass die Klasse sich folgendermaßen (z.B. in einem FE-Plugin) benutzen lässt:

```php
<?php

require_once('../class.myext_item_arp.php');


//
// Working with an existing record by uid:
//    
$item = new myext_item_arp(2);    // Object $item now contains the data of the record with uid 2 of the item table
echo $item->title;
$item->title = 'supertest';    // new data is stored in the object
$item->update();                // new data is saved to db


//
// Working with an existing record by other field:
//    
$item = myext_item_arp::findByField('title', 'supertest');    // Only the first matching record will be returned
echo $item->uid;                                                // E.g. 2


//
// Creating new Record
//
$item = new myext_item_arp;
$item->title = 'new record';
$time = time();
$item->tstamp = $time;
$item->crdate = $time;
$item->descr = 'This is the new record';
$item->insert();                                    // Saves the new record to DB
echo $item->uid;                                    // Automatically contains the received uid

//
// Using 1:n-Objects
//
// Assume item table has a field 'cat' pointing to the uid of a category table,
// which is also part of the same extension. They both have an ARP Class.
$item = new tx_myext_item(2);
echo $item->cat;                    // Returns the uid of the category;
echo $item->cat->title                // Returns the field 'title' of the category record
$item->cat->title = 'new title';
$item->cat->update();                // Also works!

?>
```

Wie immer bin ich offen für Vorschläge, Meinungen, Kritik und Lob.

P.S.: Alle Daten werden per später Initialisierung ausgelesen um Ressourcen zu sparen.

Edit: Die 0.1 verursachte einen Fatal Error. Habe eine neue Version losgeschickt.

---

Quelle: „Vorstellung: ARP Creator“, typo3.net, https://www.typo3.net/d/75595-vorstellung-arp-creator
Beiträge von Mitgliedern des Forums. Bitte mit Link auf die Diskussion zitieren.
