All pastes #904042 Raw Edit

Jemand

public text v1 · immutable
·published 2008-02-14 17:48 UTC
rendered paste body
Article:
    tableName: article
    actAs:
        I18n:
           fields: [title, subtitle, introtext, maintext, metakey, metadesc]

    columns:
        id:
            notnull: true
            primary: true
            autoincrement: true
            type: integer
            length: 11
            name: id
        en_workingtitle:
            type: string
            length: 64
        title: 
            type: string
            length: 255
        subtitle: 
            type: string
            length: 255
        introtext: 
            type: string
            length: 64000
        maintext: 
            type: string
            length: 64000
        imagelarge:
            type: string
            length: 1000
        imagesmall:
            type: string
            length: 1000
        metakey: 
            type: string
            length: 255
        metadesc: 
            type: string
            length: 1024
        layout: 
            type: string
            length: 10
        publishstatus:
            type: string
            length: 16
        created_by: 
            type: integer
        updated_by: 
            type: integer
        created_at:
            type: timestamp
        updated_at:
            type: timestamp
        publish_from: 
            type: timestamp
        publish_to: 
            type: timestamp

            
Relatedarticle:
    tableName: relatedarticle
    columns:
        article_id:
            type: integer 
            length: 11
        related_id:
            type: integer
            length: 11
        sortorder:
            type: integer 
            length: 11
    relations:
        Article:
            local: article_id
            foreign: id
            foreignAlias: RelatedArticles
            type: one
        Related:
            local: related_id
            foreign: id
            class: Article
            type: one


public function executeRelatedarticle()
{
	$this->relatedarticle = Doctrine::getTable('Article')->find($this->getRequestParameter('id'));
	$this->rootarticle    = Doctrine::getTable('Article')->find($this->getRequestParameter('articleid'));
	$relatedarticle       = new Relatedarticle();
	$relatedarticle->article_id = $this->rootarticle->id;
	$relatedarticle->related    = $this->relatedarticle->id;
	$relatedarticle->save();
	$this->relations = Doctrine_Query::create()->from('Relatedarticle ra')->where('ra.article_id = ?')->execute(array($this->rootarticle));
}