remg / generatorbundle Goto Github PK
View Code? Open in Web Editor NEWCode generation tools for Symfony3.
License: MIT License
Code generation tools for Symfony3.
License: MIT License
Hi,
After invoking php bin/console remg:generate:entity, whatever I type as the name of the entity, I now get:
In ClassMetadataInfo.php line 3265:
Notice: Trying to get property of non-object
And the command exits.
I have used remg generator before with success, but now I get this when trying to use it on any new Symfony 3.4 project. Is this easily fixable? In light of the new entity generation tools in Symfony 4, is remg generator bundle now an abandoned project?
Thanks for any help!
Jamie
Can I use your bundle like follows?
php bin/console doctrine:generate:entity --entity AppBundle:Account --no-interaction --format=annotation --fields="accountTypeId:integer accountNumber:integer title:string(length=255) description:text createdAt:datetime updatedAt:datetime" ___ relation Related"" ___
When I use this bundle with symfony 3.4, I get the following error when trying to create an entity.
Entity name:
> App\Entity\Post
[ERROR] The bundle "App" does not exist.
In symfony 3.4+, the concept of bundle for the main app is deprecated.
Do you want some help to repair the bundle ? I found it very useful for my students, especialy when they are complete beginners.
When I add a OneToMany
association mapping to the Post
class, between Post
and Category
classes, I expect the generator to suggest the plural form for the inverse mapping part : posts
, and not post
.
Association name:
> categories
Association type [OneToMany]:
[0] OneToOne
[1] ManyToOne
[2] OneToMany
[3] ManyToMany
> 2
Target entity [AppBundle:Category]:
>
Bidirectional ? (yes/no) [yes]:
>
Mapped by : [post]:
> posts
Except this little detail, this is a nice tool to have. I find it quite complicated to teach all those annotations to complete beginners. I usually end up correcting their code myself. I was even thinking about creating something like this. Nice work ๐
When I add a *ToMany
association mapping on the Tag
class, between Tag
and Post
classes, the generator creates a remove*()
method wich does not return $this
:
/**
* Remove post
*
* @param \AppBundle\Entity\Post $post
*/
public function removePost(\AppBundle\Entity\Post $post)
{
$this->posts->removeElement($post);
}
This is better :
/**
* Remove post
*
* @param \AppBundle\Entity\Post $post
*
* @return Tag
*/
public function removePost(\AppBundle\Entity\Post $post)
{
$this->posts->removeElement($post);
return $this;
}
When I add a ManyToMany
association mapping to the Post
, class between Post
and Category
classes, I expect the generator to add also this method :
/**
* Set tags
*
* @param \AppBundle\Entity\Tag $tags
*
* @return Category
*/
public function setTags(\AppBundle\Entity\Tag $tags = null)
{
$this->tags = $tags;
return $this;
}
When I add a ManyToOne
association mapping to the Category
, class between Category
and Post
classes, I expect the generator to add also these methods :
/**
* Add post
*
* @param \AppBundle\Entity\Post $post
*
* @return Post
*/
public function addPost(\AppBundle\Entity\Post $post)
{
$this->posts[] = $post;
return $this;
}
/**
* Remove post
*
* @param \AppBundle\Entity\Post $post
*/
public function removePost(\AppBundle\Entity\Post $post)
{
$this->posts->removeElement($post);
}
Note, that I expect the same for the inverse (owned) side.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.