Ver Mensaje Individual
  #4 (permalink)  
Antiguo 01/02/2011, 12:18
Avatar de masterpuppet
masterpuppet
Software Craftsman
 
Fecha de Ingreso: enero-2008
Ubicación: Montevideo, Uruguay
Mensajes: 3.550
Antigüedad: 16 años, 4 meses
Puntos: 845
Respuesta: como puedo agregar un hasMutator en yaml con doctrine

Tenes que crear el behavior:

Código PHP:
Ver original
  1. class EncryptTemplate extends Doctrine_Template
  2. {
  3.     public function setUp()
  4.     {
  5.         $this->hasMutator('password', '_encrypt_password');
  6.     }
  7.  
  8.     public function _encrypt_password
  9.     ....
  10. }

y luego agregarlo al yml:

Código YML:
Ver original
  1. usuario:
  2.   actAs:
  3.     [Timestampable, EncryptTemplate]
  4.   columns:
  5.     id:
  6.       type: integer(10)
  7.       primary: true
  8.       autoincrement: true
  9.     username:
  10.       type: string(255)
  11.       unique: true
  12.     password:
  13.       type: string(255)
  14.     email:
  15.       type: varchar(255)
  16.       unique: true

Saludos.
__________________
http://es.phptherightway.com/
thats us riders :)