After deploy Magento 2 Translation Extension by Magefan i got following error
{"0":"Warning: class_implements(): Class TranslationGridDataProvider does not exist and could not be loaded in \/home\/419982.cloudwaysapps.com\/vftydjkdjd\/public_html\/vendor\/magento\/framework\/Code\/Reader\/ClassReader.php on line 71","1":"<pre>#1 class_implements('TranslationGridD...') called at [vendor\/magento\/framework\/Code\/Reader\/ClassReader.php:71]\n#2 Magento\\Framework\\Code\\Reader\\ClassReader->getParents('TranslationGridD...') called at [vendor\/magento\/framework\/View\/Element\/UiComponent\/Argument\/Interpreter\/ConfigurableObject.php:118]\n#3 Magento\\Framework\\View\\Element\\UiComponent\\Argument\\Interpreter\\ConfigurableObject->getParents('TranslationGridD...') called at [vendor\/magento\/framework\/View\/Element\/UiComponent\/Argument\/Interpreter\/ConfigurableObject.php:96]\n#4 Magento\\Framework\\View\\Element\\UiComponent\\Argument\\Interpreter\\ConfigurableObject->evaluate(array('name' => 'dataProvider', 'argument' => array('class' => array('name' => 'class', 'xsi:type' => 'string', 'value' => 'TranslationGridD...'), 'name' => array('name' => 'name', 'xsi:type' => 'string', 'value' => 'translation_tran...'), 'primaryFieldName' => array('name' => 'primaryFieldName', 'xsi:type' => 'string', 'value' => 'key_id'), 'requestFieldName' => array('name' => 'requestFieldName', 'xsi:type' => 'string', 'value' => 'id'), 'data' => array('name' => 'data', 'xsi:type' => 'array', 'item' => array('config' => array('name' => 'config', 'xsi:type' => 'array', 'item' => array('component' => array('name' => 'component', 'xsi:type' => 'string', 'value' => 'Magento_Ui\/js\/gr...'), 'update_url' => array('name' => 'update_url', 'xsi:type' => 'url', 'path' => 'mui\/index\/render'), 'storageConfig' => array('name' => 'storageConfig', 'xsi:type' => 'array', 'item' => array('indexField' => array('name' => 'indexField', 'xsi:type' => 'string', 'value' => 'key_id')))))))))) called at [generated\/code\/Magento\/Framework\/Data\/Argument\/InterpreterInterface\/Proxy.php:95]\n#5 Magento\\Framework\\Data\\Argument\\InterpreterInterface\\Proxy->evaluate(array('name' => 'dataProvider', 'argument' => array('class' => array('name' => 'class', 'xsi:type' => 'string', 'value' => 'TranslationGridD...'), 'name' => array('name' => 'name', 'xsi:type' => 'string', 'value' => 'translation_tran...'), 'primaryFieldName' => array('name' => 'primaryFieldName', 'xsi:type' => 'string', 'value' => 'key_id'), 'requestFieldName' => array('name' => 'requestFieldName', 'xsi:type' => 'string', 'value' => 'id'), 'data' => array('name' => 'data', 'xsi:type' => 'array', 'item' => array('config' => array('name' => 'config', 'xsi:type' => 'array', 'item' => array('component' => array('name' => 'component', 'xsi:type' => 'string', 'value' => 'Magento_Ui\/js\/gr...'), 'update_url' => array('name' => 'update_url', 'xsi:type' => 'url', 'path' => 'mui\/index\/render'), 'storageConfig' => array('name' => 'storageConfig', 'xsi:type' => 'array', 'item' => array('indexField' => array('name' => 'indexField', 'xsi:type' => 'string', 'value' => 'key_id')))))))))) called at [vendor\/magento\/framework\/Data\/Argument\/Interpreter\/Composite.php:61]\n#6 Magento\\Framework\\Data\\Argument\\Interpreter\\Composite->evaluate(array('name' => 'dataProvider', 'argument' => array('class' => array('name' => 'class', 'xsi:type' => 'string', 'value' => 'TranslationGridD...'), 'name' => array('name' => 'name', 'xsi:type' => 'string', 'value' => 'translation_tran...'), 'primaryFieldName' => array('name' => 'primaryFieldName', 'xsi:type' => 'string', 'value' => 'key_id'), 'requestFieldName' => array('name' => 'requestFieldName', 'xsi:type' => 'string', 'value' => 'id'), 'data' => array('name' => 'data', 'xsi:type' => 'array', 'item' => array('config' => array('name' => 'config', 'xsi:type' => 'array', 'item' => array('component' => array('name' => 'component', 'xsi:type' => 'string', 'value' => 'Magento_Ui\/js\/gr...'), 'update_url' => array('name' => 'update_url', 'xsi:type' => 'url', 'path' => 'mui\/index\/render'), 'storageConfig' => array('name' => 'storageConfig', 'xsi:type' => 'array', 'item' => array('indexField' => array('name' => 'indexField', 'xsi:type' => 'string', 'value' => 'key_id')))))))))) called at [vendor\/magento\/module-ui\/Config\/Data.php:164]\n#7 Magento\\Ui\\Config\\Data-
Please make sure that when installing Magento 2 Translation Extension you followed the installation instructions, especially the step
php bin/magento setup:di:compile
Related
I am using yjra datatable and html builder plugin. i want to show two datatable in one view. i am getting error like can not reinitialize
Controller :
public function edit($id ,Builder $builder){
$this->htmlBuilder->ajax(route('backend.ajax.my_peoples', ['project_id'=> $project->project_id,'request' => 'ajax_listing']));
$people_html = $this->htmlBuilder->columns([
['data' => 'project_person_role', 'name' => 'project_person_role', 'title' => 'Person Role'],
['data' => 'project_person_sort', 'name' => 'project_person_sort', 'title' => 'Sort'],
['data' => 'project_person_status', 'name' => 'project_person_status', 'title' => 'Status'],
['data' => 'action', 'name' => 'action', 'title' => 'Action', 'orderable' => false, 'searchable' => false, 'width' => '10%'],
]);
$this->htmlBuilder->ajax(route('backend.ajax.my_consultants', ['project_id'=> $project->project_id,'request' => 'ajax_listing']));
$dt_html = $this->htmlBuilder->columns([
['data' => 'project_consultant_role', 'name' => 'project_consultant_role', 'title' => 'Consultant Role'],
['data' => 'project_consultant_sort', 'name' => 'project_consultant_sort', 'title' => 'Sort'],
['data' => 'project_consultant_status', 'name' => 'project_consultant_status', 'title' => 'Status'],
['data' => 'action', 'name' => 'action', 'title' => 'Action', 'width' => '5%', 'orderable' => false, 'searchable' => false]
]);
return view('backend.projects.projects')->with([
'view_type' => 'edit',
'view_title' => 'Update',
'cslt_html' => $dt_html,
'people_html' => $people_html
]);
}
I have a grid, in this grid I have filter. Grid code is:
$this->widget('booster.widgets.TbGridView', array(
'id' => 'sam',
'type' => 'striped bordered condensed',
'dataProvider' => $dataProvider,
'responsiveTable' => true,
'enableHistory' => true,
'filter' => $asset,
'columns' => array(
array(
'name' => 'id',
'header' => '#',
'filter' => false,
'type' => 'text',
),
array(
'name' => 'user',
'header' => 'Registered By',
'type' => 'text',
'value' => '$data["assignedBy"]',
),
array(
'name' => 'createdAt',
'header' => 'Created At',
'type' => 'datetime',
),
array(
'name' => 'serial',
'header' => 'Serial',
),
array(
'name' => 'brand',
'header' => 'Brand',
),
array(
'name' => 'model',
'header' => 'Model',
),
array(
'name' => 'assetType',
'type' => 'text',
'filter' => \wsi\it\model\AssetType::getRepository()->getTypeTree(),
'value' => '$data["assetTypeName"]',
'header' => 'Type',
),
array(
'name' => 'assigned',
'value' => '(isset($data["assignedTo"]))? $data["assignedTo"]:null',
'header' => 'Assigned To',
),
array(
'name' => 'location',
'filter' => \wsi\hr\Facade::getInstance()->getLocations(),
'value' => '$data["locationName"]',
'header' => 'Location',
),
array(
'name' => 'status',
'header' => 'Status',
'filter' => \wsi\it\model\Asset::$statusOptionList,
'value' => '\wsi\it\model\Asset::$statusOptionList[$data["status"]]',
),
array(
'class' => 'booster.widgets.TbButtonColumn',
'template' => '{view} {update} {delete}',
'header' => '',
'buttons' => array(
'update' => array(
'url' => '\Yii::app()->controller->createUrl("asset/create", array("id"=>$data["id"]))',
),
'view' => array(
'url' => '\Yii::app()->controller->createUrl("asset/view", array("id"=>$data["id"]))',
),
'delete' => array(
'url' => '\Yii::app()->controller->createUrl("asset/delete", array("id"=>$data["id"]))',
),
),
),
)
)
);
When Grid is rendered in the browser you can see that the filter list box contains html which is not parsed fully!
I had this problem with Yii-Booster before and I solved it with an option which I passed to that widget ('htmlOptions' => 'encode' => false) and It prevents to be treated as string, so browsers would parse it as space. That code which You can see below does not work for grid filter!
$form->dropDownListGroup($formModel, 'segmentList', array(
'wrapperHtmlOptions' => array(
'class' => 'col-md-6'
),
'widgetOptions' => array(
'data' => $segmentTreeArray,
'htmlOptions' => array(
>>> 'encode' => false, <<<
)
),
'hint' => "Press CTRL to add another item, otherwise others will be deselected",
));
BUT I am sure that I have to pass same "encode" => false to filter list too, I just can not find under what key I should pass it (htmlOptions did not work).
public function getInputFilter($em){
if (!$this->inputFilter) {
$inputFilter = new InputFilter();
$inputFilter->add(array(
'name' => 'fullName',
'required' => true,
'filters' => array(
array('name' => 'StripTags'),
array('name' => 'StringTrim'),
array('name' => 'SpecialChar')
),
'validators' => array(
array(
'name' => 'StringLength',
'options' => array(
'encoding' => 'UTF-8',
'min' => 5,
'max' => 100,
),
),
),
));
$inputFilter->add(array(
'name' => 'password',
'required' => true,
'filters' => array(
array('name' => 'StripTags'),
array('name' => 'StringTrim'),
),
'validators' => array(
array(
'name' => 'StringLength',
'options' => array(
'encoding' => 'UTF-8',
'min' => 1,
'max' => 100,
),
),
),
));
$inputFilter->add(array(
'name' => 'email',
'required' => true,
'filters' => array(
array('name' => 'StripTags'),
array('name' => 'StringTrim'),
),
'validators' => array(
array(
'name' => 'EmailAddress',
),
array(
'name' => 'User\Validator\NoEntityExists',
'options'=>array(
'entityManager' =>$em,
'class' => 'User\Entity\User',
'property' => 'email',
'exclude' => array(
array('property' => 'id', 'value' => $this->getId())
)
)
)
),
));
$this->inputFilter = $inputFilter;
}
return $this->inputFilter;
}
I want to add a new function in entity called "Special Char" in all input fields, so how does one create a custom filter in a doctrine entity.
I want to add validation to avoid special char in entity because I need to use this in n no of places.
How do I implement this?
From Zend documentation:
namespace Application\Filter;
use Zend\Filter\FilterInterface;
class MyFilter implements FilterInterface
{
public function filter($value)
{
// perform some transformation upon $value to arrive on $valueFiltered
return $valueFiltered;
}
}
Then you should be able to do:
$inputFilter->add(array(
'name' => 'fullName',
'required' => true,
'filters' => array(
array('name' => 'Application\Filter\MyFilter')
…
I have a field in the form like this:
$this -> add(array(
'type' => 'field-set',
'name' => 'meta_properties',
'options' => array(
'label' => "Meta Properties",
),
'elements' => array(
)
));
$meta_fieldSet = $this -> get('meta_properties');
$meta_fieldSet->add(array(
'name' => 'meta_title',
'attributes' => array(
'type' => 'text',
),
'options' => array(
'label' => 'Title',
),
));
$meta_fieldSet->add(array(
'name' => 'meta_description',
'attributes' => array(
'type' => 'text',
),
'options' => array(
'label' => 'Description',
),
));
$meta_fieldSet->add(array(
'name' => 'meta_keywords',
'attributes' => array(
'type' => 'text',
),
'options' => array(
'label' => 'Keywords',
)
));
And in my input filter class I have
$inputFilter -> add($factory -> createInput(array(
'name' => 'meta_title',
'required' => false,
'filters' => array(
array('name' => 'StripTags'),
array('name' => 'StringTrim'),
),
'validators' => array(
array(
'name' => 'StringLength',
'options' => array(
'encoding' => 'UTF-8',
'min' => 5,
'max' => 150,
),
),
),
)));
$inputFilter -> add($factory -> createInput(array(
'name' => 'meta_description',
'required' => false,
'filters' => array(
array('name' => 'StripTags'),
array('name' => 'StringTrim'),
),
'validators' => array(
array(
'name' => 'StringLength',
'options' => array(
'encoding' => 'UTF-8',
'min' => 5,
'max' => 150,
),
),
),
)));
$inputFilter -> add($factory -> createInput(array(
'name' => 'meta_keywords',
'required' => false,
'filters' => array(
array('name' => 'StripTags'),
array('name' => 'StringTrim'),
),
'validators' => array(
array(
'name' => 'StringLength',
'options' => array(
'encoding' => 'UTF-8',
'min' => 5,
'max' => 150,
),
),
),
)));
It is not validating. How to validate InputFilter?
When creating Fieldsets you need to extend \Zend\Form\Fieldset. Try creating a fieldset like this:
<?php
/**
* Fieldset Example
*/
namespace Module\Form;
use Zend\Form\Fieldset;
use Zend\InputFilter\InputFilterProviderInterface;
use Zend\Stdlib\Hydrator\ClassMethods as ClassMethodsHydrator;
class NewFieldset extends Fieldset implements InputFilterProviderInterface
{
public function __construct()
{
// we want to ignore the name passed and give it our own
parent::__construct('appointment');
// Use the model you are associating with your fieldset here
$this->setHydrator(new ClassMethodsHydrator(false))
->setObject(new MyModel)
->setLabel('My Model');
$this->add(array(
'name' => 'fieldset_item_1',
'type' => 'Select',
'options' => array(
'label' => 'FieldSet Item 1',
)
));
$this->add(array(
'name' => 'fieldset_item_2',
'type' => 'Select',
'options' => array(
'label' => 'FieldSet Item 2',
)
));
}
/**
* Sets up the input filter specification and returns it
*/
public function getInputFilterSpecification()
{
return array(
'fieldset_item_1' => array(
'required' => false,
'filters' => array(
array('name' => 'StripTags'),
array('name' => 'StringTrim'),
),
'validators' => array(
array(
'name' => 'StringLength',
'options' => array(
'encoding' => 'UTF-8',
'min' => 1,
'max' => 100,
),
),
),
),
'fieldset_item_2' => array(
'required' => false,
'filters' => array(
array('name' => 'StripTags'),
array('name' => 'StringTrim'),
),
'validators' => array(
array(
'name' => 'StringLength',
'options' => array(
'encoding' => 'UTF-8',
'min' => 1,
'max' => 100,
),
),
),
),
);
}
}
Then you can use it in your form like this:
$this->add(array(
'type' => 'Zend\Form\Element\Collection',
'name' => 'fieldset',
'options' => array(
'label' => '',
'count' => 1,
'should_create_template' => true,
'allow_add' => true,
'use_as_base_fieldset' => false,
'create_new_objects' => true,
'target_element' => array('type' => 'Module\Form\NewFieldset')
),
));
Now when you perform $form->isValid() in a controller it will validate the fieldset. In addition, you can now make some fancy front-end code to dynamically add and remove fieldsets from the form and they will all get validated.
I started a project with Zend Framework 2 and I set up the modules ZfcUser and BjyAuthorize.
The ZfcUser part works correctly but when I active BjyAuthorize an error occurs
Doctrine\ORM\EntityNotFoundException: Entity was not found. in /vendor/doctrine/orm/lib/Doctrine/ORM/Proxy/ProxyFactory.php on line 177
Call Stack
here is my config file :
- comper.json
{
"name": "zendframework/skeleton-application",
"description": "Skeleton Application for ZF2",
"license": "BSD-3-Clause",
"keywords": [
"framework",
"zf2"
],
"homepage": "http://framework.zend.com/",
"require": {
"php": ">=5.3.3",
"zendframework/zendframework": "2.3.*",
"zf-commons/zfc-user": "dev-master",
"zendframework/zftool": "dev-master",
"doctrine/doctrine-orm-module": "0.8.0",
"gedmo/doctrine-extensions": "v2.3.9",
"zendframework/zend-developer-tools": "dev-master",
"zf-commons/zfc-user-doctrine-orm": "dev-master",
"zf-commons/zfc-admin": "dev-master",
"bjyoungblood/bjy-authorize": "1.4.0"
}
}
application.config.php
return array(
'modules' => array(
'ZendDeveloperTools',
'ZfcAdmin',
'DoctrineModule',
'DoctrineORMModule',
'ZfcBase',
'ZfcUser',
'ZfcUserDoctrineORM',
'BjyAuthorize',
'Application',
'Fountain',
'Rest',
),
'module_listener_options' => array(
'module_paths' => array(
'./module',
'./vendor',
),
'config_glob_paths' => array(
'config/autoload/{,*.}{global,local}.php',
),
),
);
bjyauthorize.global.php
return array(
'bjyauthorize' => array(
'default_role' => 'guest',
'identity_provider' => 'BjyAuthorize\Provider\Identity\ZfcUserZendDb',
'role_providers' => array(
'BjyAuthorize\Provider\Role\Config' => array(
'guest' => array(),
'user' => array('children' => array(
'admin' => array(),
)),
),
'BjyAuthorize\Provider\Role\ZendDb' => array(
'table' => 'role',
'identifier_field_name' => 'id',
'role_id_field' => 'roleId',
'parent_role_field' => 'parent_id',
),
'BjyAuthorize\Provider\Role\ObjectRepositoryProvider' => array(
'role_entity_class' => 'Fountain\Entity\Role',
'object_manager' => 'doctrine.entitymanager.orm_default',
),
),
'resource_providers' => array(
'BjyAuthorize\Provider\Resource\Config' => array(
'pants' => array(),
),
),
'rule_providers' => array(
'BjyAuthorize\Provider\Rule\Config' => array(
'allow' => array(
array(array('guest', 'user'), 'pants', 'wear')
),
'deny' => array(
// ...
),
),
),
'guards' => array(
'BjyAuthorize\Guard\Controller' => array(
array('controller' => 'index', 'action' => 'index', 'roles' => array('guest','user')),
array('controller' => 'index', 'action' => 'stuff', 'roles' => array('user')),
array(
'controller' => array('index', 'static', 'console'),
'action' => array('list', 'manage'),
'roles' => array('guest', 'admin')
),
array(
'controller' => array('search', 'administration'),
'roles' => array('staffer', 'admin')
),
array('controller' => 'zfcuser', 'roles' => array()),
),
'BjyAuthorize\Guard\Route' => array(
array('route' => 'zfcuser', 'roles' => array('user')),
array('route' => 'zfcuser/logout', 'roles' => array('user')),
array('route' => 'zfcuser/login', 'roles' => array('guest')),
array('route' => 'zfcuser/register', 'roles' => array('guest')),
// Below is the default index action used by the ZendSkeletonApplication
array('route' => 'home', 'roles' => array('guest', 'user')),
array('route' => 'home', 'roles' => array('guest', 'user', 'admin')),
array('route' => 'fountain', 'roles' => array('guest', 'user')),
array('route' => 'fountain/add', 'roles' => array( 'admin')),
array('route' => 'fountain/delete', 'roles' => array('admin')),
array('route' => 'fountain/edit', 'roles' => array('admin')),
),
),
),
);
zfcuserdoctrineorm.global.php
return array(
'doctrine' => array(
'driver' => array(
// overriding zfc-user-doctrine-orm's config
'zfcuser_entity' => array(
'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
'paths' => array( __DIR__ .'/../../module/Fountain/src/Fountain/Entity'),
),
'orm_default' => array(
'drivers' => array(
'Fountain\Entity' => 'zfcuser_entity',
),
),
),
),
'zfcuser' => array(
// telling ZfcUser to use our own class
'user_entity_class' => 'Fountain\Entity\User',
'enable_default_entities' => false,
),
);
Anyone have an idea of the origin of this problem?