Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
listTableNames example
if
(
empty
(
$this
->tableMapping
)
)
{
$this
->tableMapping =
$this
->
createTableMapping
(
)
;
}
try
{
$this
->
createTargetDirectory
(
$this
->
getPath
(
)
)
;
}
catch
(
Exception
$e
)
{
return
[
'success' => false, 'error' => self::CREATE_TARGET_DIRECTORY_FAILED, 'message' =>
$e
->
getMessage
(
)
]
;
}
$errors
=
[
]
;
foreach
(
$this
->
getSchemaManager
(
)
->
listTableNames
(
)
as
$tableName
)
{
if
(
!
empty
(
$tableNames
)
&& !\
in_array
(
$tableName
,
$tableNames
)
)
{
continue
;
}
if
(
!
$this
->
stringEndsWith
(
$tableName
, '_attributes'
)
)
{
continue
;
}
$table
=
$this
->
getSchemaManager
(
)
->
listTableDetails
(
$tableName
)
;
$sourceCode
=
$this
->
generateModel
(
$table
)
;
class
DynamicPrimaryKeyChangeTest
extends
TestCase
{
use
KernelTestBehaviour;
public
function
testPrimaryKeyExistsEverywhere
(
)
: void
{
$connection
=
$this
->
getContainer
(
)
->
get
(
Connection::
class
)
;
$schemaManager
=
$connection
->
createSchemaManager
(
)
;
$tables
=
$schemaManager
->
listTableNames
(
)
;
foreach
(
$tables
as
$tableName
)
{
$indexes
=
$schemaManager
->
listTableIndexes
(
$tableName
)
;
static
::
assertArrayHasKey
(
'primary',
$indexes
)
;
}
}
public
function
testFullConversionAgainstFixtures
(
)
: void
{
$connection
=
$this
->
getContainer
(
)
->
get
(
Connection::
class
)
;