Questions? How to generate getters and setters in Symfony CMS for documents? Why namespace TaskBundle or Acme\TaskBundle is not recognised by the command doctrine:entities generate?
I have installed the standard-edition of CMS and try to make examples from official documentation: http://symfony.com/doc/master/cmf/book/database_layer.html
I need to generate setters and getters for the Document Task.php
For this i decided to use command "doctrine:generate:entities". Thus created a new folder Entities and copied Task.php file from Document folder: C:\Bitnami\wampstack-5.4.38-0\sym_prog\standard-edition\src\Acme\TaskBundle\Entity\Task.php I hoped to generate setters and getters and than copy them back to the Document\Task.php
Command doctrine:generate:entities was not existing. Thus i updated comsposer.json C:\Bitnami\wampstack-5.4.38-0\sym_prog\standard-edition\composer.json
"require": {
...
"doctrine/orm": "^2.4.8",
"doctrine/doctrine-bundle": "~1.4",
But now i am getting the error about namespace:
c:\Bitnami\wampstack-5.4.38-0\sym_prog\standard-edition>php app/console generate:doctrine:entities TaskBundle:Task
[Doctrine\ORM\ORMException]
Unknown Entity namespace alias 'TaskBundle'.
c:\Bitnami\wampstack-5.4.38-0\sym_prog\standard-edition>php app/console generate:doctrine:entity
The Entity shortcut name: Acme/TaskBundle:Task
Bundle "Acme\TaskBundle" does not exist.
The Entity shortcut name: TaskBundle:Task
Bundle "TaskBundle" does not exist.
C:\Bitnami\wampstack-5.4.38-0\sym_prog\standard-edition\src\Acme\TaskBundle\Entity\Task.php
<?php
/* If you use annotations, you'll need
* to prepend all annotations with @PHPCR\,
* which is the name of the imported namespace
* (e.g. @PHPCR\Document(..)),
* this is not shown in Doctrine's documentation.
* You'll also need to include the
* use Doctrine\ODM\PHPCR\Mapping\Annotations as PHPCR;
* statement to import the PHPCR annotations prefix. */
// src/Acme/TaskBundle/Entity/Task.php
namespace Acme\TaskBundle\Entity;
class Task
{
/**
* @PHPCR\Id()
*/
protected $id;
/**
* @PHPCR\String()
*/
protected $description;
/**
* @PHPCR\Boolean()
*/
protected $done = false;
/**
* @PHPCR\ParentDocument()
*/
protected $parentDocument;
}
Questions?
How to generate getters and setters in Symfony CMS for documents?
Why namespace TaskBundle or Acme\TaskBundle is not recognised by the command doctrine:entities generate?