An abstract factory could not create an instance of UserTable

Zend Framework 2

This is a second time in a day that I got this error message:

An abstract factory could not create an instance of UserTable

This is what I had to change to fix it (old code):

file: module.config.php

    'di' => array(
        'services' => array(
            // 'StillReCAPTCHA\Model\UserTable' => 'StillReCAPTCHA\Model\UserTable',
            'StillReCAPTCHA\Model\UserMetaTable' => 'StillReCAPTCHA\Model\UserMetaTable',
        )
    ),

then replace it with this (new code):

file: module.php

'factories' => array(
	 'StillReCAPTCHA\Model\UserTable' => function($sm) {
		$tableGateway = $sm->get('UserTableGateway');
		$table = new UserTable($tableGateway);
		return $table;
	},
	 'UserTable' => function($sm) {
		$tableGateway = $sm->get('UserTableGateway');
		$table = new UserTable($tableGateway);
		return $table;
	},
	 'UserTableGateway' => function($sm) {
	 	$dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
		$resultSetPrototype = new HydratingResultSet();
		$resultSetPrototype->setObjectPrototype(new User());
		$tableName = 'users';
		return new TableGateway($tableName, $dbAdapter, null, $resultSetPrototype);
	 },
),

Add target=”_blank” to Mashmenu

If your site uses the Mashmenu plug and you would like one of your menu item links to open in a new window, Mashmenu provides the mashmenu_meta filter to do this. Just do a string replace on the href parameter to add the target=”_blank” parameter to the A tag.

Place this code in your theme’s functions.php file.

function mashmenu_page_content( $content ) {

	/* add target blank*/
	$content = str_replace('http://www.google.com/"', 'http://www.google.com/" target="_blank"', $content);
	return $content;

} add_filter('mashmenu_meta', 'mashmenu_page_content');