January 29th, 2010 — 12:24am
Just a couple of snippets found in the net to make my life easier.
In the first one beware of the grave accent quotes.
rm -rf `find . -type d -name .svn`
or someone else proposed
find ./ -name .svn | xargs rm -fr
Comment » | Linux, snippet
December 1st, 2009 — 11:57am
Given the example class foo:
class foo {
public static function myFunc() {
return "foo - myFunc";
}
}
The class name is known in the calling context:
The class name is stored in a php var:
$class_name = "foo";
/** PHP 5.2.x */
echo call_user_func(array($class_name, "myFunc"));
/** PHP 5.3.x */
echo $class_name::myFunc();
More info on call_user_func: http://es.php.net/manual/en/function.call-user-func.php
More info on static keyword: http://es.php.net/manual/en/language.oop5.static.php
Comment » | php
November 16th, 2009 — 11:47am
-
Be sure that sfFormExtraPlugin is installed:
$ php symfony plugin:install sfFormExtraPlugin
-
In the template:
<?php use_javascript('ui/i18n/jquery-ui-i18n.js') ?>
-
In the filter or form:
$this->widgetSchema['my_date_field'] = new sfWidgetFormJQueryDate(array(
'culture' => 'es',
'format' => '%day%/%month%/%year%',
'config' => '{"showMonthAfterYear": false, "firstDay": 1 }'
));
More info on ‘config’ option in http://jqueryui.com/demos/datepicker.
Comment » | Symfony
June 29th, 2009 — 2:33pm
Syntaxis for some simple but frecuently used symfony commands
Database
Configure symfony to use especific mysql database
$ symfony configure:database "mysql:host=localhost;dbname=my_database" user_name password
Rebuild all. This command rebuild models, form, and tables, so destroy all data in database.
$ symfony propel:build-all
Rebuild all and load test data. This command rebuild models, form, and tables, so destroy all data in database and reload it from fixture files.
$ symfony propel:build-all-load
Frontend and Backend
Frontend Aplication. Generate frontend application
$ symfony generate:app --escaping-strategy=on --csrf-secret=FrontendSecret frontend
Frontend Module. Generate a module called module_name in frontend application. The module will have a show action in addition to the new, edit and delete ones.
$ symfony propel:generate-module --with-show --non-verbose-templates frontend module_name ModelObject
BackEnd Aplication. Generate backend application
$ symfony generate:app --escaping-strategy=on --csrf-secret=BackendSecret backend
BackEnd Module. Generate a fully functional module called ‘module_name’ in the backend, based on the model object named ‘ModuleObject’.
$ symfony propel:generate-admin backend ModuleObject --module=module_name
Comment » | Symfony