Generate Form from exist Entity Symfony4 - forms

I have a table in the database which has a large number of columns. I know that EasyAdminBundle is out there and I used it in the past to create forms based on database tables. How can create this based on Entity? So that I can generate the forms automatically and no populate them manually.

You can use the Symfony Maker Bundle. With this bundle, you can generate code if you are using a version of Symfony later than 3.4. For older versions you can use Sensio Generator Bundle.
In your case, install the Maker Bundle with composer:
composer require symfony/maker-bundle --dev
Then run this command (and follow the steps) to create your form:
php bin/console make:form
To see all make commands you can use, run php bin/console list make

As symfony 4.4 you can do :
./bin/console make:entity YourFormType \\Your\\Path\\To\\Entity
From the command help :
Description:
Creates a new form class
Usage:
make:form [ <name> [<bound-class>]]

Related

Is there anyone who knows how to make a db migration files in Laminas php?

I am going to make a db migration file and migrate the file to database by using the a command.
But I can't find the command.
In Laravel we approach the goal by using this command.
php artisan make:migrate migration_client_table
Is there any similiar command that acts like the php artisan make:migrate command?
Coming from Laravel/Symfony background as well, I was asking this myself. Here are my findings:
Laminas uses laminad-db module for interactions with database. Documentation for this module however does not mention migrations at all.
Database and Models introduction to Laminas uses sql file to create a table and fill it with some original seed and does not mention altering tables at all.
Therefore I made assumption Laminas does not handle migrations at all.
Edit: According to this answer, we can use sqitch, doctrine/migrations or liquibase

Need to create modules using admin panel instead of running commands

WE are building a laravel application with crud operations , as per the backpack documentation i understood how to create a module using the command
php artisan make:migration:schema create_tags_table --model=0 --schema="name:string:unique,slug:string:unique"
php artisan migrate
STEP 2. create crud
php artisan backpack:crud tag
is there any way that i can create a new module with required columns through admin panel itself.
No, as far as I know, Backpack for Laravel doesn't have a way to create cruds from the panel itself. but you can call commands from your own controllers.
for example:
Artisan::call('backpack:crud tag');
take a look at the documentation here:
https://laravel.com/docs/7.x/artisan#programmatically-executing-commands

symfony 3.3 DoctrineMongoDBBundle error when generate documents

I install DoctrineMongoDBBundle in symfony 3.3. I follow the symfony document
http://symfony.com/doc/master/bundles/DoctrineMongoDBBundle/index.html
I create a document then I run this command bin/console doctrine:mongodb:generate:documents but I got an error
"Bundle AppBundle does not contain any mapped documents.Did you maybe forget to define a mapping configuration". I check my namespace and It was correct and my configuration file is like symfony document page

How can I make inherits of postgresql by migration in laravel 5.2?

I want yo make tables in postgresql with inherits, I foundes this http://packalyst.com/packages/package/thibaud-dauce/postgresql-schema form laravel 4.2, but it does not work whith laravel 5.2.
It shows me:
[Symfony\Component\Debug\Exception\FatalThrowableError] Fatal error: Class ThibaudDauce\PostgresqlSchema\PostgresqlSchemaServiceProvider' not found
when i try with composer update.
Could you help me please?
You can pull in this package https://packagist.org/packages/rishi-ramawat/laravel-postgresql-inherit via composer like this for using it with Laravel 5.2.* & 5.3.* :
composer require "rishi-ramawat/laravel-postgresql-inherit ~2.1.0"
This is a package which I maintain and it currently supports Laravel 5.2.*, 5.3.* & 5.4.*
For Laravel 5.4.* you would have to do:
composer require "rishi-ramawat/laravel-postgresql-inherit ~2.2"
Please read the README of this package to find out more about the complete installation procedure.
You may run it:
DB::statement("ALTER TABLE capitals INHERIT cities;");

Error with the ZF tool while setting up the GuestBook Application

Iam trying to set up the GuestBook Application which comes with zend framework tutorial , Iam following the steps one by one,
However when I enter this command - zf create db-table Guestbook guestbook
Iam getting an error, I have pasted the error here -
C:\xampp\htdocs\quickstart>zf create db-table Guestbook guestbook
An Error Has Occurred Provider 'db-table' is not a valid provider.
I tried googling and searching on zend forums, but seems no one got this sort of issue so far. Can anyone suggest me whats wrong here?
PS: I have set php in my system path and zf tool works for me, its only this specific command thats giving error.
After Lots of digging in and breaking my head with the ZF tool I found that it is using copy of Zend framework which comes with Xampp for Windows.
When I installed Xampp, Zend Framework(Version 1.9.7) got installed inside the
C:\Xampp\Php\Pear\Zend
directory and since C:\Xampp\Php is in my system path this Zend framework got picked up everytime by Zend Tool.
I copied the latest version of stable Zend Framework(1.10.2) to the Zend folder inside Php\Pear and now its works like cake for me :)
Thanks for all your suggestions!
Download latest version of framework files from this link http://www.zend.com/community/downloads & then extract zip file where you will get folder structure like ZendFramework-1.11.12/library/Zend, So from this folder copy Zend folder to Xampp/php/PEAR/zend folder. Then Go to command mode type Zf --help. Now it shows all the commands.
Now also check version of zend-framework in command mode by typing as
zf show version
it should show as version as zend Framework Version: 1.11.12
Check your version, maybe db-table is newer than your version. I just tried the same command you used (zf create db-table Guestbook guestbook) and it worked.
When i write zf show version it responds 1.11.0dev. What does your version say? If it's low, consider updating after following the changelog and testing the rest of your application with the new version of zf.