@@ -400,56 +400,8 @@ Even though Doctrine now knows how to persist a ``Product`` object to the
400400database, the class itself isn't really useful yet. Since ``Product `` is just
401401a regular PHP class with ``private `` properties, you need to create ``public ``
402402getter and setter methods (e.g. ``getName() ``, ``setName($name) ``) in order
403- to access its properties in the rest of your application's code. Fortunately,
404- the following command can generate these boilerplate methods automatically:
405-
406- .. code-block :: terminal
407-
408- $ php app/console doctrine:generate:entities AppBundle/Entity/Product
409-
410- This command makes sure that all the getters and setters are generated
411- for the ``Product `` class. This is a safe command - you can run it over and
412- over again: it only generates getters and setters that don't exist (i.e. it
413- doesn't replace your existing methods).
414-
415- .. caution ::
416-
417- Keep in mind that Doctrine's entity generator produces simple getters/setters.
418- You should review the generated methods and add any logic, if necessary,
419- to suit the needs of your application.
420-
421- .. sidebar :: More about ``doctrine:generate:entities``
422-
423- With the ``doctrine:generate:entities `` command you can:
424-
425- * generate getter and setter methods in entity classes;
426-
427- * generate repository classes on behalf of entities configured with the
428- ``@ORM\Entity(repositoryClass="...") `` annotation;
429-
430- * generate the appropriate constructor for 1:n and n: m relations.
431-
432- The ``doctrine:generate:entities `` command saves a backup of the original
433- ``Product.php `` named ``Product.php~ ``. In some cases, the presence of
434- this file can cause a "Cannot redeclare class" error. It can be safely
435- removed. You can also use the ``--no-backup `` option to prevent generating
436- these backup files.
437-
438- Note that you don't *need * to use this command. You could also write the
439- necessary getters and setters by hand. This option simply exists to save
440- you time, since creating these methods is often a common task during
441- development.
442-
443- You can also generate all known entities (i.e. any PHP class with Doctrine
444- mapping information) of a bundle or an entire namespace:
445-
446- .. code-block :: terminal
447-
448- # generates all entities in the AppBundle
449- $ php app/console doctrine:generate:entities AppBundle
450-
451- # generates all entities of bundles in the Acme namespace
452- $ php app/console doctrine:generate:entities Acme
403+ to access its properties in the rest of your application's code. Add these
404+ methods manually or with your own IDE.
453405
454406.. _doctrine-creating-the-database-tables-schema :
455407
0 commit comments