You dont need to hit control+c. You can just hit enter as stated in the message while creating entity. If you haven't typed anything then it will just exit the entity creation flow
Well to be fair, when I watched that moment I was like "wait this isn't right". And your terminal shows that as well ;) The final question is how to call the field in the actor entity but you first canceled it and a few seconds later the the terminal shows you did it again. But i'm not trying to be a smart ass, just wanted to let others be aware of the final enter there. Also, really great stuff mate. Love that I finally found a tutorial about symfony with doctrine that works. Almost lost hope finding one ^_^
@@DjVorcera thank you buddy. I’m here to improve too, maybe not in the actual coding part but definitely screen casting etc, so thanks for the feedback! :)
@@codewithdary nobodies perfect :) But the explanations are great. It is seriously helping me a lot. Looking forward to maybe seeing more symfony related videos in the future (if any haha )
@dannysdianr don't abort while mapping fields exactely in the while adding new property to relational entity after your set yes and hit enter along way to the end of the mapping process mapping automatically close you just hitting enter. PS E:\dev\localhost\htdocs\movies> symfony console make:entity classes created: src/Entity/Classes.php created: src/Repository/ClassesRepository.php
Entity generated! Now let's add some fields! You can always add more fields later manually or by re-running this command. New property name (press to stop adding fields): > class Field type (enter ? to see all types) [string]: > string Field length [255]: > 255 Can this field be null in the database (nullable) (yes/no) [no]: > yes updated: src/Entity/Classes.php >
Success!
PS E:\dev\localhost\htdocs\movies> symfony console make:entity classes Your entity already exists! So let's add some new fields! New property name (press to stop adding fields): > [critical] Error thrown while running command "make:entity classes". Message: "Aborted." error sending signal interrupt not supported by windows PS E:\dev\localhost\htdocs\movies> symfony console make:entity students created: src/Entity/Students.php created: src/Repository/StudentsRepository.php
Entity generated! Now let's add some fields! You can always add more fields later manually or by re-running this command. New property name (press to stop adding fields): > student Field type (enter ? to see all types) [string]: > string Field length [255]: > 255 Can this field be null in the database (nullable) (yes/no) [no]: > no updated: src/Entity/Students.php Add another property? Enter the property name (or press to stop adding fields): > subject Field type (enter ? to see all types) [string]: > string Field length [255]: > 255 Can this field be null in the database (nullable) (yes/no) [no]: > no updated: src/Entity/Students.php >
Success!
Next: When you're ready, create a migration with php bin/console make:migration PS E:\dev\localhost\htdocs\movies> symfony console make:entity classes Your entity already exists! So let's add some new fields! New property name (press to stop adding fields): > teachers Field type (enter ? to see all types) [string]: > relation What class should this entity be related to?: > Students What type of relationship is this? ------------ ------------------------------------------------------------------------ Type Description ------------ ------------------------------------------------------------------------ ManyToOne Each Classes relates to (has) one Students. Each Students can relate to (can have) many Classes objects. OneToMany Each Classes can relate to (can have) many Students objects. Each Students relates to (has) one Classes. ManyToMany Each Classes can relate to (can have) many Students objects. Each Students can also relate to (can also have) many Classes objects. OneToOne Each Classes relates to (has) exactly one Students. Each Students also relates to (has) exactly one Classes. ------------ ------------------------------------------------------------------------ Relation type? [ManyToOne, OneToMany, ManyToMany, OneToOne]: > ManyToMany Do you want to add a new property to Students so that you can access/update Classes objects from it - e.g. $students->getClasses()? (yes/no) [yes]: > yes A new property will also be added to the Students class so that you can access the related Classes objects from it. New field name inside Students [classes]: > updated: src/Entity/Classes.php updated: src/Entity/Students.php Add another property? Enter the property name (or press to stop adding fields): >
Success!
have you see the updated propmt for both entity if you see in your terminal you doing corect you will get what we see in this videos as a output. if have any more questions reach out to www.linkedin.com/in/vasudevan-n-r-481b70151/
Which VS Code extension did you use exactly to visualize the tables? Is it specific to MySQL? I've searched for extensions and there are many, but I don't to install a bunch of them. I just want to install the "best".
this series of symfony is really good and following it with the doc . but i just wanna know if anyone found a solution for anotation ? somehow on my controller th anototation works fine but inside the modal , these anotation is returned as error by intelephense #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] Solution : in your console do => composer require doctrine/annotations go to your extensions in vscode => PHP intelephense and disable it , (reload the vscode) AND THEN enable it. Leave a like here or a comment so that everyone fix the issue quickly
Symfony, make me a new entity or php/bin console, make me a new entity is actually a very good nmemonic for learning how to create entities out of your head so thanks for sharing it with us Code With Dary!
the relation doesnt work for me when i do it from the cli even though everything is green but it just doesnt generate the methods and the tables, foreign key..
in symfony 6.2 you should pass relation to field type then follow instructure $ php bin/console make:entity Class name of the entity to create or update (e.g. BraveChef): > Product New property name (press to stop adding fields): > category Field type (enter ? to see all types) [string]: > relation What class should this entity be related to?: > Category Relation type? [ManyToOne, OneToMany, ManyToMany, OneToOne]: > ManyToOne
I am getting this when i run " symfony console make:entity " and tells me create name of entity i enterted " Movie " as said in the video 2:45 " [critical] Error thrown while running command "make:entity". Message: "An exception occurred in the driver: could not find driver" please help me with this dary
2:24 If i try "symfony console make:entity" and then type in "Movie", i get the error message: Doctrine ORM Manager named "" does not exist. I also tried the same with "Movies", there i get the error message: Cannot find the entity manager for class "App\Entity\Movies"
Instead of creating the entity like this: /** * @ORM\Entity(repositoryClass=MovieRepository::class) */ class Movie { /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; It created like: #[ORM\Entity(repositoryClass: MovieRepository::class)] class Movie { #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column(type: 'integer')] private $id; I'm not sure what did I do wrong and how to fix that.
@@codewithdary Believe me, I understand. I've been an English teacher for a long time, English is one of the most difficult languages on the planet, many Americans can't even speak it well. Then you add in loan words like the French façade "fa-SAHD" and it gets even crazier. I speak 12 languages and have lived all over the world and English is really hard for non native speakers. May I ask what your mother tongue is? I'm guessing something Slavic/Eastern European, perhaps Russian or Bulgarian?
Want to learn more about me? Let’s connect through Instagram.
instagram.com/codewithdary
The explanations here are very clear.
Thank you so much from this, you're easing my transition.
I'm jumping straight from Django ORM. 🙌
You dont need to hit control+c. You can just hit enter as stated in the message while creating entity. If you haven't typed anything then it will just exit the entity creation flow
Thank you
10:11 Could be my setup, however, I had to press enter on "New field name inside Actor [movies]:" rather than immediately using, [control + C]
Ah yeah, that works too!
Anyways, thanks for sharing!
Well to be fair, when I watched that moment I was like "wait this isn't right".
And your terminal shows that as well ;)
The final question is how to call the field in the actor entity but you first canceled it and a few seconds later the the terminal shows you did it again.
But i'm not trying to be a smart ass, just wanted to let others be aware of the final enter there.
Also, really great stuff mate.
Love that I finally found a tutorial about symfony with doctrine that works.
Almost lost hope finding one ^_^
@@DjVorcera thank you buddy. I’m here to improve too, maybe not in the actual coding part but definitely screen casting etc, so thanks for the feedback! :)
@@codewithdary nobodies perfect :)
But the explanations are great. It is seriously helping me a lot.
Looking forward to maybe seeing more symfony related videos in the future (if any haha
)
Great video, easy to understand thank you so much
You are welcome Bader!
10:49 When i follow your instruction, i check my Actor.php, i cannot find private $movies. Why ???. Oh don't mind, just press enter on cmd. Thank you
@codewithdary why don't you reply this i have facing same issue give it solution
@dannysdianr don't abort while mapping fields exactely in the while adding new property to relational entity after your set yes and hit enter along way to the end of the mapping process mapping automatically close you just hitting enter.
PS E:\dev\localhost\htdocs\movies> symfony console make:entity classes
created: src/Entity/Classes.php
created: src/Repository/ClassesRepository.php
Entity generated! Now let's add some fields!
You can always add more fields later manually or by re-running this command.
New property name (press to stop adding fields):
> class
Field type (enter ? to see all types) [string]:
> string
Field length [255]:
> 255
Can this field be null in the database (nullable) (yes/no) [no]:
> yes
updated: src/Entity/Classes.php
>
Success!
PS E:\dev\localhost\htdocs\movies> symfony console make:entity classes
Your entity already exists! So let's add some new fields!
New property name (press to stop adding fields):
> [critical] Error thrown while running command "make:entity classes". Message: "Aborted."
error sending signal interrupt not supported by windows
PS E:\dev\localhost\htdocs\movies> symfony console make:entity students
created: src/Entity/Students.php
created: src/Repository/StudentsRepository.php
Entity generated! Now let's add some fields!
You can always add more fields later manually or by re-running this command.
New property name (press to stop adding fields):
> student
Field type (enter ? to see all types) [string]:
> string
Field length [255]:
> 255
Can this field be null in the database (nullable) (yes/no) [no]:
> no
updated: src/Entity/Students.php
Add another property? Enter the property name (or press to stop adding fields):
> subject
Field type (enter ? to see all types) [string]:
> string
Field length [255]:
> 255
Can this field be null in the database (nullable) (yes/no) [no]:
> no
updated: src/Entity/Students.php
>
Success!
Next: When you're ready, create a migration with php bin/console make:migration
PS E:\dev\localhost\htdocs\movies> symfony console make:entity classes
Your entity already exists! So let's add some new fields!
New property name (press to stop adding fields):
> teachers
Field type (enter ? to see all types) [string]:
> relation
What class should this entity be related to?:
> Students
What type of relationship is this?
------------ ------------------------------------------------------------------------
Type Description
------------ ------------------------------------------------------------------------
ManyToOne Each Classes relates to (has) one Students.
Each Students can relate to (can have) many Classes objects.
OneToMany Each Classes can relate to (can have) many Students objects.
Each Students relates to (has) one Classes.
ManyToMany Each Classes can relate to (can have) many Students objects.
Each Students can also relate to (can also have) many Classes objects.
OneToOne Each Classes relates to (has) exactly one Students.
Each Students also relates to (has) exactly one Classes.
------------ ------------------------------------------------------------------------
Relation type? [ManyToOne, OneToMany, ManyToMany, OneToOne]:
> ManyToMany
Do you want to add a new property to Students so that you can access/update Classes objects from it - e.g. $students->getClasses()? (yes/no) [yes]:
> yes
A new property will also be added to the Students class so that you can access the related Classes objects from it.
New field name inside Students [classes]:
>
updated: src/Entity/Classes.php
updated: src/Entity/Students.php
Add another property? Enter the property name (or press to stop adding fields):
>
Success!
have you see the updated propmt for both entity if you see in your terminal you doing corect you will get what we see in this videos as a output.
if have any more questions reach out to www.linkedin.com/in/vasudevan-n-r-481b70151/
Great tuto
Thank you Zakaria!
Which VS Code extension did you use exactly to visualize the tables? Is it specific to MySQL? I've searched for extensions and there are many, but I don't to install a bunch of them. I just want to install the "best".
this series of symfony is really good and following it with the doc . but i just wanna know if anyone found a solution for anotation ? somehow on my controller th anototation works fine but inside the modal , these anotation is returned as error by intelephense
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
Solution :
in your console do => composer require doctrine/annotations
go to your extensions in vscode => PHP intelephense and disable it , (reload the vscode) AND THEN enable it.
Leave a like here or a comment so that everyone fix the issue quickly
Solution is in read more
Thank you!
Symfony, make me a new entity or php/bin console, make me a new entity is actually a very good nmemonic for learning how to create entities out of your head so thanks for sharing it with us Code With Dary!
Thank you so much for your kind words
the relation doesnt work for me when i do it from the cli even though everything is green but it just doesnt generate the methods and the tables, foreign key..
in symfony 6.2 you should pass relation to field type then follow instructure
$ php bin/console make:entity
Class name of the entity to create or update (e.g. BraveChef):
> Product
New property name (press to stop adding fields):
> category
Field type (enter ? to see all types) [string]:
> relation
What class should this entity be related to?:
> Category
Relation type? [ManyToOne, OneToMany, ManyToMany, OneToOne]:
> ManyToOne
@@alionides Thank you, I was searching for this
@@jeanrakotoarison1976 Welcome
I am getting this when i run " symfony console make:entity " and tells me create name of entity i enterted " Movie " as said in the video 2:45
" [critical] Error thrown while running command "make:entity". Message: "An exception occurred in the driver: could not find driver"
please help me with this dary
You are missing a PHP extension for your database driver. Please install that, and restart your web server.
@@codewithdary Please Can you elaborate it more. i didn't get i am on intial stage of learning. Please tell me with step by step.
good job bro
Big up Najim!!
Thank Yoou
Thank you for watching Lasitha!!
2:24
If i try "symfony console make:entity" and then type in "Movie",
i get the error message: Doctrine ORM Manager named "" does not exist.
I also tried the same with "Movies", there i get the error message:
Cannot find the entity manager for class "App\Entity\Movies"
I use Php 8.2.5 and Symfony 6
Thanks
Welcome!
Instead of creating the entity like this:
/**
* @ORM\Entity(repositoryClass=MovieRepository::class)
*/
class Movie
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
It created like:
#[ORM\Entity(repositoryClass: MovieRepository::class)]
class Movie
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
I'm not sure what did I do wrong and how to fix that.
Both should work fine, right?
it's just because of php version
My addActor and removeActor methods are undefined inside the Actor Entity and I do not understand why. I followed the exact same steps.. Hmm..
i have the same issue? How to solve it?
Dary, it's not "Doc-treen", it's "Doc-trinn".
Oops, thank you so much! Sometimes I struggle with pronouncing a couple words, also with 'Facade' in Laravel, hehe.
@@codewithdary Believe me, I understand. I've been an English teacher for a long time, English is one of the most difficult languages on the planet, many Americans can't even speak it well. Then you add in loan words like the French façade "fa-SAHD" and it gets even crazier. I speak 12 languages and have lived all over the world and English is really hard for non native speakers. May I ask what your mother tongue is? I'm guessing something Slavic/Eastern European, perhaps Russian or Bulgarian?