Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ////////////////////////////// config-connections -------->
- 'orm_maxfoodapp' => array(
- 'driverClass' => 'DoctrineDBALDriverPDOMySqlDriver',
- 'params' => array(
- 'host' => 'localhost',
- 'port' => '3306',
- 'user' => 'root',
- 'password' => 'root',
- 'dbname' => 'maxfood_application',
- 'driver' => 'pdo_mysql',
- 'driverOptions' => array(
- 1002 => "SET NAMES 'UTF8'"
- )
- )
- ),
- 'configuration' => array(
- ////////////////////////////// config-extra-configuration -------->
- 'orm_maxfoodapp' => array(
- 'metadata_cache' => 'array',
- 'query_cache' => 'array',
- 'result_cache' => 'array',
- 'hydration_cache' => 'array',
- 'driver' => 'orm_maxfoodapp',
- 'generate_proxies' => true,
- 'proxy_dir' => 'data/DoctrineORMModule4/Proxy',
- 'proxy_namespace' => 'DoctrineORMModule4Proxy',
- 'filters' => array()
- ),
- ),
- 'entitymanager' => array(
- ////////////////////////////// config-extra-entitymanager -------->
- 'orm_maxfoodapp' => array(
- 'connection' => 'orm_maxfoodapp',
- 'configuration' => 'orm_maxfoodapp'
- ),
- ),
- 'eventmanager' => array(
- ////////////////////////////// config-extra-eventmanager -------->
- 'orm_maxfoodapp' => array(),
- ),
- )
- )
- protected $em;
- protected $username;
- protected $password;
- protected $entity = "PanelEntityPersons";
- public function __construct(EntityManager $em)
- {
- $this->em = $em;
- }
- /**
- * @return mixed
- */
- public function getUsername()
- {
- return $this->username;
- }
- /**
- * @param mixed $username
- */
- public function setUsername($username)
- {
- $this->username = $username;
- return $this;
- }
- /**
- * @return mixed
- */
- public function getPassword()
- {
- return $this->password;
- }
- /**
- * @param mixed $password
- */
- public function setPassword($password)
- {
- $this->password = $password;
- return $this;
- }
- public function authenticate()
- {
- $repository = $this->em->getRepository($this->entity);
- $user = $repository->username($this->getUsername(),$this->getPassword());
- if($user) {
- return new Result(Result::SUCCESS, array('user' => $user), array('OK'));
- } else {
- return new Result(Result::FAILURE_CREDENTIAL_INVALID, null, array());
- }
- }
- public function getServiceConfig() {
- return array(
- 'factories' => array(
- 'PanelFormAccess' => function($sm) {
- return new FormAccess("access");
- },
- /////////////////////////////////////////// Serviços ->
- 'PanelServicePersons' => function($em) {
- return new ServiceAddress($em->get('doctrine.entitymanager.orm_maxfoodapp'));
- },
- 'PanelAuthenticationAdapter' => function($service) {
- return new AuthAdapter($service->get('doctrine.entitymanager.orm_maxfoodapp'));
- },
- ),
- );
- }
- public function getViewHelperConfig() {
- return array(
- 'factories' => array(
- 'flashMessage' => function($sm) {
- $flashmessenger = $sm->getServiceLocator()
- ->get('ControllerPluginManager')
- ->get('flashmessenger');
- $message = new AdminViewHelperFlashMessages( ) ;
- $message->setFlashMessenger( $flashmessenger );
- return $message ;
- },
- ),
- );
- }
- public function getConfig()
- {
- return include __DIR__ . '/config/module.config.php';
- }
- public function getAutoloaderConfig()
- {
- return array(
- 'ZendLoaderStandardAutoloader' => array(
- 'namespaces' => array(
- __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
- ),
- ),
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement