Inkonsistenzen in cAPI

Gesperrt
tono
Beiträge: 574
Registriert: Mo 25. Apr 2005, 20:51
Wohnort: Frankfurt am Main
Kontaktdaten:

Inkonsistenzen in cAPI

Beitrag von tono »

Laut API-Dokumentation und laut Implementierung in Item sollte LoadByPrimaryKey() einen Rückgabewert über den Erfolg liefern. Diverse überladene Implementierungen tun das nicht.

classes/contenido/class.client.php Zeile 151-157:

Code: Alles auswählen

	function loadByPrimaryKey ($value)
	{
		if (parent::loadByPrimaryKey($value) == true)
		{
			$this->idclient = $value;
		}
	}
muss heißen:

Code: Alles auswählen

	function loadByPrimaryKey ($value)
	{
		if (parent::loadByPrimaryKey($value) == true)
		{
			$this->idclient = $value;
			return true;
		}
		return false;
	}

Dasselbe auch in classes/contenido/class.clientlang.php Zeile 70-76:

Code: Alles auswählen

	function loadByPrimaryKey ($iID)
	{
		if (parent::loadByPrimaryKey($iID) == true)
		{
			$this->idclient = $this->get("idclient");
		}
	}
muss heißen:

Code: Alles auswählen

	function loadByPrimaryKey ($iID)
	{
		if (parent::loadByPrimaryKey($iID) == true)
		{
			$this->idclient = $this->get("idclient");
			return true;
		}
		return false;
	}
classes/contenido/class.module.php Zeile 85-100:

Code: Alles auswählen

	function loadByPrimaryKey ($id)
	{
		parent::loadByPrimaryKey($id);
		
		if ($this->_shouldLoadFromFiles())
		{
			global $cfg;
			$sRootPath = $cfg['path']['contenido'] . $cfg['path']['modules'] . $this->get("idclient")."/" . $this->get("idmod").".xml";

			if (file_exists($sRootPath))
			{
				$this->import($sRootPath);		
			}
			
		}
	}
vielleicht so:

Code: Alles auswählen

    function loadByPrimaryKey ($id)
    {
        if (parent::loadByPrimaryKey($id)){

            if ($this->_shouldLoadFromFiles())
            {
                global $cfg;
                $sRootPath = $cfg['path']['contenido'] . $cfg['path']['modules'] . $this->get("idclient")."/" . $this->get("idmod").".xml";

                if (file_exists($sRootPath))
                {
                    $this->import($sRootPath);
                }

            }
            return true;
        }
        return false;
    }
und schließlich noch classes/class.category.php Zeile 46-85

Code: Alles auswählen

	function loadByPrimaryKey ($key)
	{
		parent::loadByPrimaryKey($key);
		
		/* Load all child language items */
		$catlangs = new CategoryLanguageCollection;
		$catlangs->select("idcat = '$key'");
		
		while ($item = $catlangs->next())
		{
			$this->lang[$item->get("idlang")] = $item;	
		}
	}
so:

Code: Alles auswählen

	function loadByPrimaryKey ($key)
	{
	    if (parent::loadByPrimaryKey($key))
	    {

	        /* Load all child language items */
	        $catlangs = new CategoryLanguageCollection;
	        $catlangs->select("idcat = '$key'");

	        while ($item = $catlangs->next())
	        {
	            $this->lang[$item->get("idlang")] = $item;
	        }
	        return true;
	    }
	    return false;
	}
Bis dann
Tono
Dodger77
Beiträge: 3626
Registriert: Di 12. Okt 2004, 20:00
Wohnort: Voerde (Niederrhein)
Kontaktdaten:

Beitrag von Dodger77 »

verschoben
HerrB
Beiträge: 6935
Registriert: Do 22. Mai 2003, 12:44
Wohnort: Berlin
Kontaktdaten:

Beitrag von HerrB »

Done.

Gruß
HerrB
Bitte keine unaufgeforderten PMs oder E-Mails -> use da Forum!

Newsletter: V4.4.x | V4.6.0-15 (Module, Backend) | V4.6.22+
Standardartikelliste: V4.4.x | V4.6.x
http://www.contenido.org/forum/search.php | http://faq.contenido.org | http://www.communido.net
Gesperrt