Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getTableFromString example
/** * _getTableFromString * * @param string $tableName * @return Zend_Db_Table_Abstract */
protected
function
_getTableFromString
(
$tableName
)
{
return
Zend_Db_Table_Abstract::
getTableFromString
(
$tableName
,
$this
->_table
)
;
}
}
public
function
delete
(
$where
)
{
$depTables
=
$this
->
getDependentTables
(
)
;
if
(
!
empty
(
$depTables
)
)
{
$resultSet
=
$this
->
fetchAll
(
$where
)
;
if
(
count
(
$resultSet
)
> 0
)
{
foreach
(
$resultSet
as
$row
)
{
/** * Execute cascading deletes against dependent tables */
foreach
(
$depTables
as
$tableClass
)
{
$t
= self::
getTableFromString
(
$tableClass
,
$this
)
;
$t
->
_cascadeDelete
(
$tableClass
,
$row
->
getPrimaryKey
(
)
)
;
}
}
}
}
$tableSpec
=
(
$this
->_schema ?
$this
->_schema . '.' : ''
)
.
$this
->_name;
return
$this
->_db->
delete
(
$tableSpec
,
$where
)
;
}
/** * Called by parent table's class during delete() method. * * @param string $parentTableClassname * @param array $primaryKey * @return int Number of affected rows */