Search code examples
typo3typo3-flowneoscms

Relationships Typo3


can anyone tell me about relationship on typo 3? e.g. i got 2 tables, 'A' and 'B', currently i got simple form that can inserting data into 'A' table, the 'A' table fields are "name","id_types","address". the "id_types" is foreign_key from 'B' table. And the 'B' table fields are "id_types","types_name". How can i make this relation on typo 3?

is it something to do with persistence_object_identifier?

this is my code for trying manually adding into second table

public function createartistAction(Artist $artist)
{
        $artisttype = new Artisttype();
        $artisttype->setArtisttype_name($artist->getArtisttype_id());
        $this->ArtisttypeRepository->add($artisttype);

        $datenow = date('d/m/Y');
        $date = date_create($datenow);
        $artist->setCreated_at($date);
        $artist->setUpdated_at($date);
        $this->addFlashMessage('Artist Created.');
        $this->ArtistRepository->add($artist);          
        $this->redirectToUri('/artist/viewArtist');
}

any help would be much appreciated.

thanks


Solution

  • I guess that is here to get you started:

    http://docs.typo3.org/flow/TYPO3FlowDocumentation/TheDefinitiveGuide/PartII/Modeling.html

    All relationship in TYPO3 Flow is done in the mvc model and it uses various design patterns to make it easy for the programmer. So in your case the best way would be not to even touch the database by itself but use the opportunities the php framework offers.

    It's not a fast solution and maybe one have to read a lot before one can start. But once you understand it, it's a pretty handy way to get your data structured.