Simple code examples on how to use Symfony form builder with Ajax and jquery validators
Simple code examples on how to use Symfony form builder with Ajax and jquery validators
How to access “service container” in Symfony2.
Read More
This simple php scrips can be run by cron job once an hour to let you know if the qmail queue is getting full.
$x = shell_exec('/usr/local/psa/admin/sbin/mailqueuemng -s');
$y = explode("\n", $x);
foreach($y as $z){
$a = explode(":", $z);
$out[trim($a[0])] = trim($a[1]);
}
if ($out['Messages total'] > 100) {
mail('[email protected]', 'Email Problems', print_r($out, true));
}
All one have to do in Plesk to fix this problem is to add to the open_basedir “:/dev/urandom“. So it looks like this {WEBSPACEROOT}{/}{:}{TMP}{/}:/dev/urandom
Service needs to look like this
services: user.listener: class: AppBundle\EventListener\UserListener arguments: [ "@security.password_encoder" ] tags: [ { name: doctrine.event_listener, event: prePersist } ]
Listener should look like that
// AppBundle\EventListener\UserListener.php namespace AppBundle\EventListener; use Doctrine\ORM\Event\LifecycleEventArgs; use AppBundle\Entity\User; use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface; class UserListener { protected $container; public function __construct(UserPasswordEncoderInterface $encoder) { $this->encoder = $encoder; } public function prePersist(LifecycleEventArgs $args) { $entity = $args->getEntity(); $encodedPassword = $this->encoder->encodePassword($entity, $entity->getPassword()); $entity->setPassword($encodedPassword); } }