Recibí una consulta de Damian, uno de mis alumnos de la UAI, y lo hago Post:
Hola, tengo un inconveniente con la version que instalo de symfony que es la 1.4.1 y en la documentación que he leido los comandos que se utilizan son con el orm propel, y la version instalada o por lo menos la que yo instalo no reconoce ningun comando de propel, esto es devido a que a partir de la 1.2 utiliza doctrine como orm esta version segun esta pagina, lose porque probe comandos de doctrine y funcionan los reconoce.
Yo quisiera saber en que cambia al utilizar este orm en el schema.yml y en el databases.yml en el proyecto ¿como puedo instalar o que me reconozca los comandos de propel o la version anterior? muchas gracias
REPLY
Hola Damian!
Efectivamente, symfony 1.4 trae como predeterminado el Doctrine. No es necesario realizar ninguna instalación, ya que en el 1.3 si lo cambio momentaneamente y necesitabas instalarlo como plugin. En el 1.4, los dos vienen, pero tienes que obligarlo en la generación del proyecto a usar Propel.
Puedes regenerar el proyecto principal, y luego copiar todos los archivos encima de este, o puedes activar el sfPropelPlugin en el ProjectConfiguration.php y limpiar la caché.
Solución A:
Genera el proyecto con:
symfony generate:project prueba –orm=Propel
con eso debería ser suficiente
Solución B, edita ProjectConfiguracion.class.php
config/ProjectConfiguration.class.php
class ProjectConfiguration extends sfProjectConfiguration
{
public function setup()
{
$this->enableAllPluginsExcept(array(‘sfDoctrinePlugin’));
}
$this->enableAllPluginsExcept(array(‘sfDoctrinePlugin’)); //Habilita todos los plugins, incluido Propel (excluye Doctrine)
No olvides limpiar la caché con symfony cc
Abrazo y éxitos.
zen@prometeus:~/test$ symfony generate:project prueba >> dir+ /home/zen/test/lib
>> dir+ /home/zen/test/lib/form
>> file+ /home/zen/test/lib/form/BaseForm.class.php
>> dir+ /home/zen/test/log
>> dir+ /home/zen/test/web
>> dir+ /home/zen/test/web/js
>> dir+ /home/zen/test/web/css
>> file+ /home/zen/test/web/css/main.css
>> file+ /home/zen/test/web/.htaccess
>> file+ /home/zen/test/web/robots.txt
>> dir+ /home/zen/test/web/images
>> dir+ /home/zen/test/web/uploads
>> dir+ /home/zen/test/web/uploads/assets
>> dir+ /home/zen/test/apps
>> dir+ /home/zen/test/data
>> dir+ /home/zen/test/data/fixtures
>> file+ /home/zen/test/data/fixtures/fixtures.yml
>> dir+ /home/zen/test/test
>> dir+ /home/zen/test/test/unit
>> dir+ /home/zen/test/test/functional
>> dir+ /home/zen/test/test/bootstrap
>> file+ /home/zen/test/test/bootstrap/unit.php
>> file+ /home/zen/test/test/bootstrap/functional.php
>> dir+ /home/zen/test/cache
>> dir+ /home/zen/test/config
>> file+ /home/zen/test/config/ProjectConfiguration.class.php
>> file+ /home/zen/test/config/rsync_exclude.txt
>> file+ /home/zen/test/config/properties.ini
>> file+ /home/zen/test/symfony
>> dir+ /home/zen/test/plugins
>> tokens /home/zen/test/config/ProjectConfiguration.class.php
>> tokens /home/zen/test/config/rsync_exclude.txt
>> tokens /home/zen/test/config/properties.ini
>> tokens /home/zen/test/config/ProjectConfiguration.class.php
>> tokens /home/zen/test/config/rsync_exclude.txt
>> tokens /home/zen/test/config/properties.ini
>> tokens /home/zen/test/lib/form/BaseForm.class.php
>> file+ /home/zen/test/config/databases.yml
>> dir+ /home/zen/test/config/doctrine
>> file+ /home/zen/test/config/doctrine/schema.yml
>> chmod 777 /home/zen/test/web/uploads
>> chmod 777 /home/zen/test/cache
>> chmod 777 /home/zen/test/log
>> chmod 777 /home/zen/test/symfony
>> chmod 777 /home/zen/test/web/uploads/assets
>> tokens /home/zen/test/config/databases.yml
>> tokens /home/zen/test/config/ProjectConfiguration.class.php
>> tokens /home/zen/test/config/rsync_exclude.txt
>> tokens /home/zen/test/config/doctrine/schema.yml
>> tokens /home/zen/test/config/properties.ini
>> tokens /home/zen/test/lib/form/BaseForm.class.php
zen@prometeus:~/test$ symfony
Usage:
symfony [options] task_name [arguments]
Options:
–help -H Display this help message.
–quiet -q Do not log messages to standard output.
–trace -t Turn on invoke/execute tracing, enable full backtrace.
–version -V Display the program version.
–color Forces ANSI color output.
–xml To output help as XML
Available tasks:
:help Displays help for a task
:list Lists tasks
app
:routes Displays current routes for an application
cache
:clear Clears the cache (cc)
configure
:author Configure project author
:database Configure database DSN
doctrine
:build Generate code based on your schema
:build-db Creates database for current model (doctrine:create-db)
:build-filters Creates filter form classes for the current model
:build-forms Creates form classes for the current model
:build-model Creates classes for the current model
:build-schema Creates a schema from an existing database
:build-sql Creates SQL for the current model
:clean-model-files Delete all generated model classes for models which no longer exist in your YAML schema (doctrine:clean)
:create-model-tables Drop and recreate tables for specified models.
:data-dump Dumps data to the fixtures directory
:data-load Loads YAML fixture data
:delete-model-files Delete all the related auto generated files for a given model name.
:dql Execute a DQL query and view the results
:drop-db Drops database for current model
:generate-admin Generates a Doctrine admin module
:generate-migration Generate migration class
:generate-migrations-db Generate migration classes from existing database connections
:generate-migrations-diff Generate migration classes by producing a diff between your old and new schema.
:generate-migrations-models Generate migration classes from an existing set of models
:generate-module Generates a Doctrine module
:generate-module-for-route Generates a Doctrine module for a route definition
:insert-sql Inserts SQL for current model
:migrate Migrates database to current/specified version
generate
:app Generates a new application
:module Generates a new module
:project Generates a new project
:task Creates a skeleton class for a new task
i18n
:extract Extracts i18n strings from php files
:find Finds non “i18n ready” strings in an application
log
:clear Clears log files
:rotate Rotates an application’s log files
plugin
:add-channel Add a new PEAR channel
:install Installs a plugin
:list Lists installed plugins
:publish-assets Publishes web assets for all plugins
:uninstall Uninstalls a plugin
:upgrade Upgrades a plugin
project
:clear-controllers Clears all non production environment controllers
:deploy Deploys a project to another server
:disable Disables an application in a given environment
:enable Enables an application in a given environment
ptimize Optimizes a project for better performance
:permissions Fixes symfony directory permissions
:send-emails Sends emails stored in a queue
:validate Finds deprecated usage in a project
symfony
:test Launches the symfony test suite
test
:all Launches all tests
:coverage Outputs test code coverage
:functional Launches functional tests
:unit Launches unit tests
zen@prometeus:~/test$ rm * -Rf
zen@prometeus:~/test$ l
-bash: l: command not found
zen@prometeus:~/test$ ls
zen@prometeus:~/test$ symfony generate:project prueba –orm=Propel
>> dir+ /home/zen/test/lib
>> dir+ /home/zen/test/lib/form
>> file+ /home/zen/test/lib/form/BaseForm.class.php
>> dir+ /home/zen/test/log
>> dir+ /home/zen/test/web
>> dir+ /home/zen/test/web/js
>> dir+ /home/zen/test/web/css
>> file+ /home/zen/test/web/css/main.css
>> file+ /home/zen/test/web/.htaccess
>> file+ /home/zen/test/web/robots.txt
>> dir+ /home/zen/test/web/images
>> dir+ /home/zen/test/web/uploads
>> dir+ /home/zen/test/web/uploads/assets
>> dir+ /home/zen/test/apps
>> dir+ /home/zen/test/data
>> dir+ /home/zen/test/data/fixtures
>> file+ /home/zen/test/data/fixtures/fixtures.yml
>> dir+ /home/zen/test/test
>> dir+ /home/zen/test/test/unit
>> dir+ /home/zen/test/test/functional
>> dir+ /home/zen/test/test/bootstrap
>> file+ /home/zen/test/test/bootstrap/unit.php
>> file+ /home/zen/test/test/bootstrap/functional.php
>> dir+ /home/zen/test/cache
>> dir+ /home/zen/test/config
>> file+ /home/zen/test/config/ProjectConfiguration.class.php
>> file+ /home/zen/test/config/rsync_exclude.txt
>> file+ /home/zen/test/config/properties.ini
>> file+ /home/zen/test/symfony
>> dir+ /home/zen/test/plugins
>> tokens /home/zen/test/config/ProjectConfiguration.class.php
>> tokens /home/zen/test/config/rsync_exclude.txt
>> tokens /home/zen/test/config/properties.ini
>> tokens /home/zen/test/config/ProjectConfiguration.class.php
>> tokens /home/zen/test/config/rsync_exclude.txt
>> tokens /home/zen/test/config/properties.ini
>> tokens /home/zen/test/lib/form/BaseForm.class.php
>> file+ /home/zen/test/config/databases.yml
>> file+ /home/zen/test/config/propel.ini
>> file+ /home/zen/test/config/schema.yml
>> chmod 777 /home/zen/test/web/uploads
>> chmod 777 /home/zen/test/cache
>> chmod 777 /home/zen/test/log
>> chmod 777 /home/zen/test/symfony
>> chmod 777 /home/zen/test/web/uploads/assets
>> tokens /home/zen/test/config/databases.yml
>> tokens /home/zen/test/config/propel.ini
>> tokens /home/zen/test/config/ProjectConfiguration.class.php
>> tokens /home/zen/test/config/rsync_exclude.txt
>> tokens /home/zen/test/config/schema.yml
>> tokens /home/zen/test/config/properties.ini
>> tokens /home/zen/test/lib/form/BaseForm.class.php
zen@prometeus:~/test$ symfony
Usage:
symfony [options] task_name [arguments]
Options:
–help -H Display this help message.
–quiet -q Do not log messages to standard output.
–trace -t Turn on invoke/execute tracing, enable full backtrace.
–version -V Display the program version.
–color Forces ANSI color output.
–xml To output help as XML
Available tasks:
:help Displays help for a task
:list Lists tasks
app
:routes Displays current routes for an application
cache
:clear Clears the cache (cc)
configure
:author Configure project author
:database Configure database DSN
generate
:app Generates a new application
:module Generates a new module
:project Generates a new project
:task Creates a skeleton class for a new task
i18n
:extract Extracts i18n strings from php files
:find Finds non “i18n ready” strings in an application
log
:clear Clears log files
:rotate Rotates an application’s log files
plugin
:add-channel Add a new PEAR channel
:install Installs a plugin
:list Lists installed plugins
:publish-assets Publishes web assets for all plugins
:uninstall Uninstalls a plugin
:upgrade Upgrades a plugin
project
:clear-controllers Clears all non production environment controllers
:deploy Deploys a project to another server
:disable Disables an application in a given environment
:enable Enables an application in a given environment
ptimize Optimizes a project for better performance
:permissions Fixes symfony directory permissions
:send-emails Sends emails stored in a queue
:validate Finds deprecated usage in a project
propel
:build Generate code based on your schema
:build-all Generates Propel model and form classes, SQL and initializes the database
:build-all-load Generates Propel model and form classes, SQL, initializes the database, and loads data
:build-filters Creates filter form classes for the current model
:build-forms Creates form classes for the current model
:build-model Creates classes for the current model
:build-schema Creates a schema from an existing database
:build-sql Creates SQL for the current model
:data-dump Dumps data to the fixtures directory
:data-load Loads YAML fixture data
:generate-admin Generates a Propel admin module
:generate-module Generates a Propel module
:generate-module-for-route Generates a Propel module for a route definition
:graphviz Generates a graphviz chart of current object model
:insert-sql Inserts SQL for current model
:schema-to-xml Creates schema.xml from schema.yml
:schema-to-yml Creates schema.yml from schema.xml
symfony
:test Launches the symfony test suite
test
:all Launches all tests
:coverage Outputs test code coverage
:functional Launches functional tests
:unit Launches unit tests
RSS feed for comments on this post. TrackBack URL
En realidad no hace falta que genere el proyecto desde 0, sólo es necesario habilitar el plugin de propel en projectConfiguration.class.php y deshabilitar el plugin de doctrine. Una vez hecho esto, limpia la caché y ya está,
Gracias Javi por tu aporte, mejoré un poco la redacción para que se entienda mejor la segunda solución que proponíamos, que bien como tu dices, es también adecuada al problema. Exitos!
I enjoyed the article and thanks recompense posting such valuable colloquy seeing that all of us to figure out, I develop it both of upset and edifying and I map to identify it as commonly as I can.
After reading you blog, Your blog is very useful for me .I bookmarked your blog!
Wishes your valentine day to be joyful!
Saw your site bookmarked on Reddit.I love your site and marketing strategy.Your site is very useful for me .I bookmarked your site!
їPuedo tomar obtener Foto de su blog?
Have a nice day
Miato
Seguro, una foto? Una captura de pantalla querras decir?