Symfony database Usage (ii)

Source: Internet
Author: User

Symfony can be used to reverse-generate entities based on data, with 3.3.* as an example:

PHP bin/console doctrine:mapping:import--force appbundle xml

          The first step in building an entity class from an existing database is to require doctrine to introspect the database and generate the corresponding metadata file.   The metadata file describes the entity classes to be generated based on the table field.

After you have generated the metadata file, you can let doctrine build the related entity classes by executing the following command.

PHP bin/console doctrine:mapping:convert annotation./src. If this command is not responding you can try using: Php bin/console doctrine:mapping:import appbundle Annotation

The new entity class has been generated as.

Pass

PHP bin/console doctrine:generate:entities appbundle Generation method

The entity has been generated, and the following is the way to perform database operations,

You need to understand how the database operation method can be accessed: http://symfony.com/doc/3.3/doctrine.html

Symfony database Usage (ii)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.