Archives for “Symfony”
I’m going to show a way that I’ve found to easily edit N1 relationships with the admin generator of symfony 1.2 Surely it can be polished, and maybe it could be done better another way, if you know how please let me know. We are going to use the next model schema: # config/schema.yml propel: lista: [...]
dWhen executing this code: $this->items = $object->getItens(); ... foreach($this->items as $item) { ...yadda yadda $item->getId() yadda yadada } within a symfony action, the php engine throws: Notice: Indirect modification of overloaded property xxxActions::$items has no effect in xxxactions.class.php That’s related to a php bug , whose implications in symfony are described here. It looks like it’s related to php 5.2. I can see it [...]
I was looking for some actions sharing methods weird solution (since I was trying to apply a per-action classes model, and I needed to use methods from one action onto another), and I had no luck at all. However, what I did find out was fabien saying repeteadly that actions code should not be messy, hard [...]
The concept around this is to serve a 1px image through a PHP script. This allows you to insert a new record or update an existing one about read mails. In your mail you only have to insert an image tag like this at the end of the template: <img src="<?php echo url_for('stats/image?bulletin='.$id, 'absolute=true') ?>" alt="px.gif" /> And [...]
Generating a CSV file from an action to bring it to the users of one of our websites I encountered myself with the problem of Symfony’s MVC model and decorator pattern. Although I was using echo statements directly, Symfony was waiting for the action to finish to send headers and allow the download, so the [...]
Las cabeceras X-JSON salen de un modo misterioso en la documentacion de Prototype, e incluso en la de symfony. Pues bien, tiene utilidad, vienen muy bien para enviar datos desde la operacion ajax hecha en el servidor hasta la funcion javascript que se suele ejecutar en el status ‘complete’ Pero pasemos a un ejemplo:
Es posible combinar los dos métodos de validación del symfony, de modo que se pueda usar el fichero yml para las validaciones más comunes, y el método validateXXX() para alguna validación más especial Para el caso – por ejemplo – donde uno o varios de los campos de un formulario requira una validación compleja, mientras [...]
Cuando escribimos con el symfony un form_remote_tag(), si luego pretendemos, a traves de javascript, realizar acciones cuando el evento ’submit’ del formulario ocurra, tendremos que andarmos con mucho ojo. Cuando en symfony escribimos: echo form_remote_tag(array( 'update'=>'formulario', 'url'=>'forms/microMasInfo', 'script'=>'true')); el symfony genera: <form onsubmit="new Ajax.Updater('formulario', [...]
Cuando el nombre de la tabla en la base de datos difiere del nombre en el modelo de objetos, necesitamos obtener el “phpName”. Una forma de hacer esto, útil cuando solamente tenemos un nombre de tabla y un ID, es: $tabla = Propel::getDatabaseMap()->getTable($miNombreDeTabla); $phpName = $tabla->getPhpName() ? $tabla->getPhpName() : sfInflector::camelize($tabla->getName()); return call_user_func(array($phpName.'Peer', 'retrieveByPK'), $miID); Por si a alguien le [...]
Recent Comments