You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have Symfony postgresql on docker, Installed a database, Using adminer as ui for the database.
As entities (classes/ models) I have three tables: User, UserProfile and PostEvent.
While testing on Homepage which is defined as route: "/" . I have created a method when the homepage is reached it will create a default user that I created and send it to the database to be inserted.
#[Route('/', name : "new_app")]
public function index(EntityManager $manager): Response
// public function index(): Response
{
$user = new User();
$user->setEmail('[email protected]');
$user->setPassword('12345678');
$profile = new PostEvent();
$profile->setTitle("Test Data");
$profile->setDescription("Data testing here!");
$email = $user->getEmail();
// $prf_id = $profile->getUserUniq();
$manager->persist($profile);
$manager->persist($user);
$manager->flush();
// return new Response($profiles, 200);
return $this->render(
'main/index.html.twig',
[
'user' => $email,
'profile_id' => $profile->getDescription()
]
);
}`
As seen within the codeblock I render it withh twig, also installed a profiler package that shows which queries are running/executed on a page. Everything seems fine and get a satus code of 200 on the page, and within the profiler application the query is processed and "COMMITED" .
Within the database, the table PostEvent is still empty, Also tried inserting data in other entities User and the UserProfile but also that did not work.
I tried configuring the Entity class of PostEvent and UserProfile. When I created these entities, I created them to be nullable, I tought If I made them not nullable somehow it would inser the data, this didnt worl.
Then inside the "var/log/dev.log" file the following showed:
- php.DEBUG: Warning: filemtime(): stat failed for /app/vendor/symfony/validator/Resources/translations/validators.ro.xlf [] [] (<- X1000)
- doctrine.INFO: Connecting with parameters array{"use_savepoints":true,"driver":"pdo_pgsql","host":"database","port":5432,"user":"test","password":"<redacted>","driverOptions":[],"defaultTableOptions":[],"dbname":"martial_arts_db","serverVersion":"16","charset":"utf8"} {"params":{"use_savepoints":true,"driver":"pdo_pgsql","host":"database","port":5432,"user":"test","password":"<redacted>","driverOptions":[],"defaultTableOptions":[],"dbname":"martial_arts_db","serverVersion":"16","charset":"utf8"}} []
- doctrine.DEBUG: Executing query: SELECT 1 {"sql":"SELECT 1"} []
- doctrine.INFO: Disconnecting [] []
- deprecation.INFO: User Deprecated: Relying on non-optimal defaults for ID generation is deprecated, and IDENTITY results in SERIAL, which is not recommended. Instead, configure identifier generation strategies explicitly through configuration. We currently recommend "SEQUENCE" for "Doctrine\DBAL\Platforms\PostgreSQLPlatform", when using DBAL 3, and "IDENTITY" when using DBAL 4, so you should probably use the following configuration before upgrading to DBAL 4, and remove it after deploying that upgrade: $configuration->setIdentityGenerationPreferences([ "Doctrine\DBAL\Platforms\PostgreSQLPlatform" => ClassMetadata::GENERATOR_TYPE_SEQUENCE, ]);
I not sure what the issue is with PostEvent not inserting Data in the database, But I do see that the User Class is likely deprecated. I googled this and saw a possible solution of using "composer update", I tried this and clear the application cache and clean out docker volumes, images, container. Unfotunatley It did not change the Issue with inserting data
I am really exited to work on this project, and also my first symfony and postgresqk. So I need the help.
I have also asked this question on stackoverflow see page
UPDATE:
I did find outt if I use the following command: symfony console dbal:run-sql 'SELECT * FROM post_event'
That it does show something in the database...
The data I posted :D .....
id | title | description | created
- - - - - - - - - - - - - - - - - - -
1 | Test Data | Data testing here!
- - - - - - - - - - - - - - - - - - -
2 | Test Data | Data testing here!
But how come I dont see it back in the database.. I dont see it in schema 'public' within the adminer panel Does anyone has a clue?
But when I search user command: symfony console dbal:run-sql 'SELECT * FROM user'
I see one column, with two rows, containing ont he first 'user' and second row 'test'
user (column name)
- - - - - - - - - -
test (1)
I excepted to see a email and password, But it looks like the user I use to log into the adminer panel.
I am now looking how to fix this, I might have to customly create the User, because within the log.. I keep seeing that the User class is deprecated.
But still weird I dont see the data in the database.
I hope to be able to create (,update, read and delete) data and see it back inside the adminer (docker container). And continue with the project I am working on.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have Symfony postgresql on docker, Installed a database, Using adminer as ui for the database.
As entities (classes/ models) I have three tables: User, UserProfile and PostEvent.
While testing on Homepage which is defined as route: "/" . I have created a method when the homepage is reached it will create a default user that I created and send it to the database to be inserted.
`class MainController extends AbstractController
{
As seen within the codeblock I render it withh twig, also installed a profiler package that shows which queries are running/executed on a page. Everything seems fine and get a satus code of 200 on the page, and within the profiler application the query is processed and "COMMITED" .
Within the database, the table PostEvent is still empty, Also tried inserting data in other entities User and the UserProfile but also that did not work.
I tried configuring the Entity class of PostEvent and UserProfile. When I created these entities, I created them to be nullable, I tought If I made them not nullable somehow it would inser the data, this didnt worl.
Then inside the "var/log/dev.log" file the following showed:
I not sure what the issue is with PostEvent not inserting Data in the database, But I do see that the User Class is likely deprecated. I googled this and saw a possible solution of using "composer update", I tried this and clear the application cache and clean out docker volumes, images, container. Unfotunatley It did not change the Issue with inserting data
I am really exited to work on this project, and also my first symfony and postgresqk. So I need the help.
If there are any questions left, please ask?
github: projectGitHubPage
I have also asked this question on stackoverflow see page
UPDATE:
I did find outt if I use the following command: symfony console dbal:run-sql 'SELECT * FROM post_event'
That it does show something in the database...
The data I posted :D .....
But how come I dont see it back in the database.. I dont see it in schema 'public' within the adminer panel Does anyone has a clue?
But when I search user command: symfony console dbal:run-sql 'SELECT * FROM user'
I see one column, with two rows, containing ont he first 'user' and second row 'test'
I excepted to see a email and password, But it looks like the user I use to log into the adminer panel.
I am now looking how to fix this, I might have to customly create the User, because within the log.. I keep seeing that the User class is deprecated.
But still weird I dont see the data in the database.
I hope to be able to create (,update, read and delete) data and see it back inside the adminer (docker container). And continue with the project I am working on.
Beta Was this translation helpful? Give feedback.
All reactions