feed icon indicating copy to clipboard operation
feed copied to clipboard

Refactor fixures as entities rather than sql

Open tacman opened this issue 1 year ago • 2 comments

app:setup doesn't work with sqlite, I think because you can't send multiple sql statements to ->execute().

My quick hack fix:

            if (true === isset($count['total']) && 0 == $count['total']) {
                foreach (explode("\n", $file) as $sqlStatement) {
                    if ($sqlStatement) {
                        $connection->executeQuery($sqlStatement);
                    }
                }
                $output->writeln('<info>Feed data inserted</info>');

but really these shouldn't be sql statements, they should be simple Action entities.

$action = (new Action())->setTitle(..)->setReverse();

Even better would be to check if the action existed first, so that new actions could be added without resetting the database.

tacman avatar Mar 15 '24 14:03 tacman

I made a quick test, even the command bin/console doctrine:schema:create doesn't work with SQLite

stephanediondev avatar Mar 16 '24 18:03 stephanediondev

For sqlite, use

bin/console doctrine:database:create bin/console d:sch:update --force

On Sat, Mar 16, 2024 at 12:48 PM Stéphane Dion @.***> wrote:

I made a quick test, even the command bin/console doctrine:schema:create doesn't work with SQLite

— Reply to this email directly, view it on GitHub https://github.com/stephanediondev/feed/issues/31#issuecomment-2002085452, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEXIQLLYG4T6U52JY64OEDYYSHV7AVCNFSM6AAAAABEYDJFQ2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBSGA4DKNBVGI . You are receiving this because you authored the thread.Message ID: @.***>

tacman avatar Mar 16 '24 19:03 tacman