Zend Framework 2 + Doctrine: try to authenticate - authentication

I´m trying to authenticate in Zend Framework 2 + Doctrine:
I think i added everything which I need to Module.php + module.config.php
In my Controller I do:
$authService = $this->getServiceLocator()->get('Zend\Authentication\AuthenticationService');
$adapter = $authService->getAdapter();
$adapter->setIdentityValue($formdata['username']);
$adapter->setCredentialValue($formdata['password']);
$authResult = $adapter->authenticate();
It works until $adapter->authenticate();
Error is:
Warning: class_parents(): Class does not exist and could not be loaded
in
/.../doctrine/common/lib/Doctrine/Common/Persistence/Mapping/RuntimeReflectionService.php
on line 40
public function getParentClasses($class)
{
return class_parents($class); //Line 40
}

Related

When try to make a new migration table with posts it shows following error

$ php artisan migrate
Error
Class "CreatePostsTable" not found
at E:\Xampp\htdocs\Udemy\vendor\laravel\framework\src\Illuminate\Database\Migrations\Migrator.php:453
449▕ public function resolve($file)
450▕ {
451▕ $class = Str::studly(implode('', array_slice(explode('', $file), 4)));
452▕
➜ 453▕ return new $class;
454▕ }
455▕
456▕ /**
457▕ * Get all of the migration files in a given path.
1 E:\Xampp\htdocs\Udemy\vendor\laravel\framework\src\Illuminate\Database\Migrations\Migrator.php:189
Illuminate\Database\Migrations\Migrator::resolve("2020_12_29_055715_create_posts_table")
2 E:\Xampp\htdocs\Udemy\vendor\laravel\framework\src\Illuminate\Database\Migrations\Migrator.php:165
Illuminate\Database\Migrations\Migrator::runUp("E:\Xampp\htdocs\Udemy\database\migrations/2020_12_29_055715_create_posts_table.php")

Phalcon mongodb cannot update

I can't update a document with Phalcon MongoCollection from Incubator 3.3
I don't get any error after save() but data are not updated.
My code is:
$category = CategoryModel::findById($id);
$category->title = 'uno';
$category->save();
I have also tried with incubator 3.4 and 3.2
I don't know why but after calling the singleton:
MyModel::findById($id)
...the source collection I defined on the model constructor changes from 'myCustomCollection' to 'my_model'
I fixed it by adding some temporary code inside the _getResultSet method from app/vendor/phalcon/incubator/Library/Phalcon/Mvc/MongoCollection.php (Line 310)
$cursor->setTypeMap(['root' => get_class($base), 'document' => 'array']);
if (true === $unique) {
/**
* Looking for only the first result.
*/
$output = current($cursor->toArray());
$output->setSource($base->getSource());
return $output;
}

How to flush invalid SPWebConfigModifications

How do I flush out invalid SPWebConfigModifications?
I tried to execute some invalid modifications as part of a solution and now I cannt get rid of them, everytime I run ApplyWebConfigModifications it tries to execute the invalid modifications.
How do flush them out of the system?
For future reference (after banging my head on the wall for 3 days):
You can use this tool:
http://ianankers.wordpress.com/2011/07/14/web-config-modification-manager-for-sharepoint-2010/
It will list all the mods for every WebApp installed in your farm, you can add new ones and remove old ones.
The tool will only list modifications at webapp level, if you installed mods at the farm level you need to run a script like:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Navigation;
using Microsoft.SharePoint.Administration;
namespace ModTool
{
class Program
{
static void Main(string[] args)
{
SPSite site = new SPSite(args[0]);
SPWebService service = site.WebApplication.Farm.Services.GetValue<SPWebService>();
if (args.Length == 1 || string.IsNullOrEmpty(args[1]))
{
Console.Out.WriteLine("Listing all Mods and Owners");
foreach (SPWebConfigModification mod in service.WebConfigModifications)
{
Console.Out.WriteLine("Mod:" + mod.Name + ", Owner:" + mod.Owner);
}
}
else
{
Console.Out.WriteLine("Removing all mods owner:" + args[1] + ", reference site:" + args[0]);
List<SPWebConfigModification> toDelete = new List<SPWebConfigModification>();
foreach (SPWebConfigModification mod in service.WebConfigModifications)
{
if (mod.Owner == args[1])
{
toDelete.Add(mod);
}
}
Console.Out.WriteLine("Found " + toDelete.Count + "Mods");
foreach (SPWebConfigModification mod in toDelete)
{
service.WebConfigModifications.Remove(mod);
}
service.Update();
SPWebService.ContentService.ApplyWebConfigModifications();
Console.Out.WriteLine("Done!!");
}
}
}
}
Usage:
ModTool http://site - List all the mods for the farm, site is just an entry point
ModTool http://site owner -Deletes all the mods for the far wich owner is "owner"

[Zend_Form][1.11.1] Error Message Fatal error: Class 'Admin_Form_Login' not found in ...\modules\default\controllers\IndexController.php

I don't speak english fluently (i'm french) so i will be
i followed the tutorial here and i got this structure
Application
--Modules
------admin
---------controller
---------views
------etat
---------controller
---------views
------default
---------controller
---------views
--configs
bootstrap.php
My problem is that, when i created my first form and tried to view it in my browser, i got the following error:
Fatal error: Class 'Admin_Form_Login' not found in C:\wamp\www\get\application\modules\default\controllers\IndexController.php on line 14.
Here is my code:
My controller : /modules/etat/controller/IndexController.php
class Etat_IndexController extends Zend_Controller_Action
{
public function init()
{
/* Initialize action controller here */
}
public function indexAction()
{
// action body
$form = new Etat_Form_InfoAgent();
$this->view->form = $form;
}
}
My form : /modules/etat/forms/InfoAgent.php
class Etat_Form_InfoAgent extends Zend_Form
{
public function init()
{
/* Form Elements & Other Definitions Here ... */
$this->setName('infoagent');
$this->setMethod('post');
$login = new Zend_Form_Element_Text('matricule');
$login->setLabel('Matricule:');
$login->setRequired(true);
$login->addFilter('StripTags');
$login->addFilter('StringTrim');
$this->addElement($login);
$password = new Zend_Form_Element_Password('agence');
$password->setLabel('Code agence:');
$password->setRequired(true);
$password->addFilter('StripTags');
$password->addFilter('StringTrim');
$this->addElement($password);
$submit = new Zend_Form_Element_Submit('submit');
$submit->setLabel('Valider');
//$submit->style = array('float: right');
$this->addElement($submit);
}
}
My view : /modules/etat/view/script/index.phtml
<br /><br />
<div id="view-content">
<?php echo $this->form; ?>
</div>
Configuration file : configs/application.ini
[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0
;Modular structure
resources.modules[] =
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.frontController.params.prefixDefaultModule = "1"
;database ressources
resources.db.adapter = PDO_MYSQL
resources.db.params.host = localhost
resources.db.params.username = root
resources.db.params.password =
resources.db.params.dbname = bd_test
[staging : production]
[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1
I have searched the web for solution but i didn't get it. I saw a post about the same problem on your website (stackoverflow) and i tried to aplly your instructions without solving my problem.
i precise that i haven't change the code on my bootstrap and my public/index.php file
I hope you could help me soon.
thx
Make sure you have created a Bootstrap.php in each module directory, which looks like:
class Admin_Bootstrap extends Zend_Application_Module_Bootstrap
{}
In which Admin is the name of the module.
Also, make sure there is actually a file Login.php inside directory modules/admin/forms with a class Admin_Form_Login

Zend Framework: Multidb fails to initialize

This used to work but after some modifications by the other programmers it just fails to work. I have this code on my Bootstrap:
protected function _initDatabase ()
{
$resource = $this->getPluginResource('multidb');
$resource->init();
Zend_Registry::set('gtap', $resource->getDb('gtap'));
Zend_Registry::set('phpbb', $resource->getDb('phpbb'));
}
Upon loading, this error shows up:
Fatal error: Call to a member function init() on a non-object in
/var/www/gamebowl3/application/Bootstrap.php on line 105
My php.ini has this entry on tis include_path:
.:/usr/share/php:/etc/apache2/libraries
and the i can see that multidb.php is located in:
/etc/apache2/librarties/Zend/Application/Resource
Can somebody tell me what causes the error? Thanks!
I just found out that the problem is in application.ini. Added a newly-introduced setting to the usual set of configs. Here it is:
;Gtap Database
resources.multidb.gtap.adapter = "PDO_MYSQL"
resources.multidb.gtap.host = "localhost"
resources.multidb.gtap.username = "root"
resources.multidb.gtap.password = "letmein1"
resources.multidb.gtap.dbname = "gtap"
resources.multidb.gtap.isDefaultTableAdapter = true
resources.multidb.gtap.default = true
;Forum Database
resources.multidb.phpbb.adapter = "PDO_MYSQL"
resources.multidb.phpbb.host = "localhost"
resources.multidb.phpbb.username = "root"
resources.multidb.phpbb.password = "letmein1"
resources.multidb.phpbb.dbname = "phpbb"
resources.multidb.phpbb.isDefaultTableAdapter = false
Also, make sure you have the latest Zend Framework Library and add it to PHP's include path. That should fix everything up.