Removed minor bug and implemented stub of first class
This commit is contained in:
parent
cb6068bfd6
commit
b3e28d7884
@ -1,7 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<buildpath>
|
||||
<buildpathentry kind="src" path="src"/>
|
||||
<buildpathentry external="true" kind="lib" path="/home/private/slt/joomla"/>
|
||||
<buildpathentry external="true" kind="lib" path="/home/private/slt/joomla">
|
||||
<accessrules>
|
||||
<accessrule kind="nonaccessible" pattern="administrator/components/com_clubs"/>
|
||||
</accessrules>
|
||||
</buildpathentry>
|
||||
<buildpathentry external="true" kind="lib" path="/srv/slt-dev"/>
|
||||
<buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/>
|
||||
</buildpath>
|
||||
|
@ -10,6 +10,7 @@ JLoader::discover('Clubs', JPATH_ROOT . '/administrator/components/com_clubs/mym
|
||||
JLoader::registerPrefix('AbstractClubs', JPATH_ROOT . '/administrator/components/com_clubs/abstract');
|
||||
JLoader::registerPrefix('AbstractCommonClubs', JPATH_ROOT . '/administrator/components/com_clubs/common/abstract');
|
||||
// JLoader::registerPrefix('ClubsHelper', JPATH_ROOT . '/administrator/components/com_clubs/common/helper');
|
||||
JLoader::registerPrefix('CommonClubsModel', JPATH_ROOT . '/administrator/components/com_clubs/common/models');
|
||||
|
||||
$controller = BaseController::getInstance("Clubs");
|
||||
$input = Factory::getApplication()->input;
|
||||
|
@ -94,7 +94,8 @@ abstract class AbstractCommonClubsModel
|
||||
|
||||
foreach($attribs as $k => $v)
|
||||
{
|
||||
$q->select($q->qn($v['col'], $k));
|
||||
$rawColName = isset($v['col']) ? $v['col'] : $k;
|
||||
$q->select($q->qn($rawColName, $k));
|
||||
}
|
||||
$q->from($factory->getTableName());
|
||||
$q->where("id = {$this->id}");
|
||||
@ -253,7 +254,11 @@ abstract class AbstractCommonClubsModel
|
||||
{
|
||||
$q->insert($factory->getTableName());
|
||||
|
||||
$dbcols = array_map(function ($v){return $v['col'];}, $attribs);
|
||||
$dbcols = array();
|
||||
foreach($attribs as $k => $v)
|
||||
{
|
||||
$dbcols[] = isset($v['col']) ? $v['col'] : $k;
|
||||
}
|
||||
|
||||
$q->columns($q->qn($dbcols));
|
||||
|
||||
@ -282,7 +287,9 @@ abstract class AbstractCommonClubsModel
|
||||
{
|
||||
$q->update($factory->getTableName());
|
||||
|
||||
$dbcols = array_map(function ($v){return $v['col'];}, $attribs);
|
||||
$dbcols = array();
|
||||
foreach($attribs as $k => $v)
|
||||
$dbcols[] = isset($v['col']) ? $v['col'] : $k;
|
||||
|
||||
$quotedData = $this->getQuotedData($attribs, $q);
|
||||
|
||||
|
@ -22,7 +22,7 @@ abstract class AbstractCommonClubsModelFactory
|
||||
* )
|
||||
*
|
||||
* The inner arrays contain the following entries:
|
||||
* - col: The name of the column in the database. Mandatory.
|
||||
* - col: The name of the column in the database. Defaults to the key name
|
||||
* - type: The type of the column. If nothing is specified, string is assumed.
|
||||
* - string
|
||||
* - int
|
||||
|
14
src/admin/common/models/club.php
Normal file
14
src/admin/common/models/club.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
// No direct access.
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
class CommonClubsModelClub extends AbstractCommonClubsModel
|
||||
{
|
||||
|
||||
protected function getFactory()
|
||||
{
|
||||
return new CommonClubsModelFactoryClub();
|
||||
}
|
||||
|
||||
}
|
34
src/admin/common/models/factory/club.php
Normal file
34
src/admin/common/models/factory/club.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
// No direct access.
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
class CommonClubsModelFactoryClub extends AbstractCommonClubsModelFactory
|
||||
{
|
||||
public function getAttributes()
|
||||
{
|
||||
return array(
|
||||
'name'=>array(),
|
||||
'address'=>array(),
|
||||
'city'=>array(),
|
||||
'homepage'=>array(),
|
||||
'mail'=>array(),
|
||||
'iban'=>array(),
|
||||
'bic'=>array(),
|
||||
'charitable'=>array('type'=>'int'),
|
||||
'president'=>array('type'=>'int', 'ref'=>'CommonClubsModelUser')
|
||||
);
|
||||
}
|
||||
|
||||
public function getTableName()
|
||||
{
|
||||
return '#__club_clubs';
|
||||
}
|
||||
|
||||
public function getClassName()
|
||||
{
|
||||
return 'CommonClubsModelClub';
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user