<?php
/**
 * DictionaryRelatedContent business
 *
 * @author Moises Heberle [moises@solis.coop.br]
 *
 * @version $Id$
 *
 * \b Maintainers \n
 * Eduardo Bonfandini [eduardo@solis.coop.br]
 * Jamiel Spezia [jamiel@solis.coop.br]
 * Luiz Gregory Filho [luiz@solis.coop.br]
 * Moises Heberle [moises@solis.coop.br]
 *
 * @since
 * Class created on 19/01/2009
 *
 * \b Organization: \n
 * SOLIS - Cooperativa de Solucoes Livres \n
 * The Gnuteca3 Development Team
 *
 * \b CopyLeft: \n
 * CopyLeft (L) 2009 SOLIS - Cooperativa de Solucoes Livres \n
 *
 * \b License: \n
 * Licensed under GPL (for further details read the COPYING file or http://www.gnu.org/copyleft/gpl.html )
 *
 * \b History: \n
 * See history in SVN repository: http://gnuteca.solis.coop.br
 */
class BusinessGnuteca3BusDictionaryRelatedContent extends GnutecaBusiness
{
    public $dictionaryRelatedContentId;
    public $dictionaryContentId;
    public $relatedContent;


    public function __construct()
    {
        $table = 'gtcDictionaryRelatedContent';
        $pkeys = 'dictionaryRelatedContentId';
        $cols  = 'dictionaryContentId,
                  relatedContent';
        parent::__construct($table, $pkeys, $cols);
    }


    public function insertDictionaryRelatedContent()
    {
    	if ($this->removeData)
    	{
    		if ( $this->dictionaryRelatedContentId != FALSE )
    		{
    			$this->deleteDictionaryRelatedContent($this->dictionaryRelatedContentId);
    		}
    		return TRUE;
    	}
        return $this->autoInsert();
    }


    public function updateDictionaryRelatedContent()
    {
    	if (($this->removeData) || (!$this->dictionaryRelatedContentId))
    	{
    		$this->insertDictionaryRelatedContent();
    		return TRUE;
    	}
        return $this->autoUpdate();
    }


    public function deleteDictionaryRelatedContent($dictionaryRelatedContentId)
    {
        return $this->autoDelete($dictionaryRelatedContentId);
    }


    public function getDictionaryRelatedContent($dictionaryRelatedContentId)
    {
        $this->clear();
        return $this->autoGet($dictionaryRelatedContentId);
    }


    public function searchDictionaryRelatedContent($toObject = false)
    {
        $this->clear();
        $filters = array(
            'dictionaryRelatedContentId'    => 'equals',
            'dictionaryContentId'           => 'equals',
            'relatedContent'                => 'ilike'
        );
        return $this->autoSearch($filters, $toObject);
    }


    public function listDictionaryRelatedContent()
    {
        return $this->autoList();
    }
}
?>