This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// In controller... | |
public function getReportAcrossDatabasesAction(Request $request) | |
{ | |
// Listen for Gearman to notify that it has data from a completed job. | |
$this->get('event_dispatcher') | |
->addListener('gearman.client.callback.complete',array($this,'gearmanCallback')); | |
$gearman = $this->get('gearman'); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
<?php | |
namespace My\DemoBundle\Gearman\Worker; | |
use Mmoreram\GearmanBundle\Driver\Gearman; | |
use Symfony\Component\DependencyInjection\Container; | |
/** | |
* @Gearman\Work( | |
* iterations = 30, | |
* description = "Test worker", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// In controller | |
public function triggerSendNotificationsAction(Request $request) | |
{ | |
// Code to get that user triggered a bunch of notifications to an array of user ids. | |
$userIds = array(.......); | |
$message = 'some message from the frontend user'; | |
//Get Gearman and tell it to run in the background a 'job' | |
$this->get('gearman')->doBackgroundJob('MyDemoBundleWorker~sendNotificationsToUsers', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Checking query: select * from sf_guard_user u LEFT JOIN sf_guard_user_profile p ON u.id=p.id | |
FK not found for u.id (sf_guard_user.id) join on p.id (sf_guard_user_profile.id)! Available mappings: | |
-sf_guard_user_group.group_id=>sf_guard_group.id | |
-sf_guard_user_group.user_id=>sf_guard_user.id | |
-sf_guard_user_permission.permission_id=>sf_guard_permission.id | |
-sf_guard_user_permission.user_id=>sf_guard_user.id | |
-sf_guard_user_profile.user_id=>sf_guard_user.id | |
-sf_guard_user_profile.participant_source_id=>participant_source.id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @Route("/login-token/{token}/{userHash}", name="participant_autologin_token") | |
* @ParamConverter("autologinToken", class="MyBundle:AutologinToken", options={"repository_method" = "findByTokenJoinWithUser"}) | |
* @Template() | |
*/ | |
public function autoLoginAction(Request $request, AutologinToken $autologinToken, $userHash){ | |
.... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function checkAvailableFunds($data,ExecutionContextInterface $context) | |
{ | |
if($data['oneField']===1&&$data['twoField']===3){ | |
$context->addViolation('No or not enough giftcodes for selected export are available!'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function setDefaultOptions(OptionsResolverInterface $resolver) | |
{ | |
$resolver->setDefaults( | |
array('constraints'=>array(new Callback(array('methods'=>array(array($this,'checkAvailableFunds'))))), | |
) | |
); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Symfony\Component\ClassLoader\ApcClassLoader; | |
use Symfony\Component\HttpFoundation\Request; | |
$loader = require_once __DIR__.'/../app/bootstrap.php.cache'; | |
// Use APC for autoloading to improve performance. | |
// Change 'sf2' to a unique prefix in order to prevent cache key conflicts | |
// with other applications also using APC. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"success":true,"msg":"","data":[]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Setfive\DemoBundle\Listener; | |
use Symfony\Component\Security\Http\Event\InteractiveLoginEvent; | |
use Symfony\Component\Security\Http\Event\SwitchUserEvent; | |
class LoginListener | |
{ | |
/** |