Skip to content

Instantly share code, notes, and snippets.

@oscargicast
Last active August 29, 2015 13:55
Show Gist options
  • Save oscargicast/8755503 to your computer and use it in GitHub Desktop.
Save oscargicast/8755503 to your computer and use it in GitHub Desktop.
"vemos las diferecias entre nuestra entidad en symfony y la db"
$ php app/console doctrine:schema:update --dump-sql
"ejecutamos comandos sql para realizar los cambios anteriores"
$ php app/console doctrine:schema:update --force
$ php app/console doctrine:generate:entities --help
"genera getter and setter para la entidad HackspaceUniChatBundle"
$ php app/console dorctrine:generate:entities HackspaceUniChatBundle:Mensaje
configuramos en chat/app/config/parameters.yml
user: hackspacer
pass: hackspacer
ip: 172.16.5.16
"If you're trying to allow remote connections to the MySQL server, then open /etc/mysql/my.conf and comment out the line bind-address 127.0.0.1"
$ php app/console doctrine:database:create
"Create a table"
php app/console doctrine:schema:create
"Con features se popula"
"
Modelo Relacional
=================
Usuario
Canal
Mensaje
Usuario* *Canal -> Usuario* 1CanalUsuario1 *Canal
Usuario1 *Mnesaje
Canal1 *Mensaje
"
"Generamos las entidades"
$ php app/console doctrine:generate:entity
The Entity shortcut name: HackspaceUniChatBundle:Usuario
Configuration format: annotation
"UsuarioRepository.php -> permite escribir querys para la entidad Usuario"
"tarea: usuario y canal hacer not null"
$ php app/console generate:doctrine:crud
$ php app/console generate:doctrine:crud --entity=HackspaceUniChatBundle:Usuario
oscar@oscar:~/projects/symfony/chat$ php app/console generate:doctrine:crud --entity=HackspaceUniChatBundle:Usuario
Welcome to the Doctrine2 CRUD generator
This command helps you generate CRUD controllers and templates.
First, you need to give the entity for which you want to generate a CRUD.
You can give an entity that does not exist yet and the wizard will help
you defining it.
You must use the shortcut notation like AcmeBlogBundle:Post.
The Entity shortcut name [HackspaceUniChatBundle:Usuario]:
By default, the generator creates two actions: list and show.
You can also ask it to generate "write" actions: new, update, and delete.
Do you want to generate the "write" actions [no]? yes
Determine the format to use for the generated CRUD.
Configuration format (yml, xml, php, or annotation) [annotation]: yml
Determine the routes prefix (all the routes will be "mounted" under this
prefix: /prefix/, /prefix/new, ...).
Routes prefix [/usuario]:
Summary before generation
You are going to generate a CRUD controller for "HackspaceUniChatBundle:Usuario"
using the "yml" format.
Do you confirm generation [yes]?
CRUD generation
Generating the CRUD code: OK
Generating the Form code: OK
Confirm automatic update of the Routing [yes]?
Importing the CRUD routes: FAILED
The command was not able to configure everything automatically.
You must do the following changes manually.
- Import the bundle's routing resource in the bundle routing file
(/home/oscar/projects/symfony/chat/src/HackspaceUni/ChatBundle/Resources/config/routing.yml).
HackspaceUniChatBundle_usuario:
resource: "@HackspaceUniChatBundle/Resources/config/routing/usuario.yml"
prefix: /usuario
____________________
Crear un usuario
elegir un canal
y chatear
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment