TYPO3 $this->bootstrap->run not load plugin controller - typo3

I have TYPO3 7.6.18 and I am making ajaxDispatcher. I stay on final study. I trying to call $this->bootstrap->run( '', $this->configuration ); but it get an error. I can't know what this error is exactly. But I'm sure problem in this line.
My $this->configuration is:
array(8) {
["pluginName"] => string(7) "Piphoto"
["vendorName"] => string(5) "Istar"
["extensionName"] => string(7) "feFiles"
["controller"] => string(5) "Photo"
["action"] => string(4) "test"
["mvc"] => array(1) {
["requestHandlers"] => array(1) {
["TYPO3\CMS\Extbase\Mvc\Web\FrontendRequestHandler"] =>
string(48) "TYPO3\CMS\Extbase\Mvc\Web\FrontendRequestHandler"
}
}
["settings"] => array(2) {
["adminemail"] => string(15) "mvnaz#yandex.ru"
["pageShowPhotoId"] => string(2) "32"
}
["persistence"] => array(1) {
["storagePid"] => string(2) "31"
}
}
Action test is allowed in local_conf. The Vendor is set right, extension name, plugin and controller too.

Sorry)
["extensionName"]=>
string(7) "fefiles"
fefiles need Fefiles - uppercase!
Thank you all for help! )

Related

How to set default selected option for Entity Type select?

so I'm trying to set a selected option in my form but I can't seem to find out how to do this. I've Googled around and everything seems to be for Symfony2 where default was a thing, this seems to be no longer the case for Symfony4.
I've tried using data and empty_data but both don't select the correct value..
# weirdly, setting to ['guru'] gets undefined index error,
# setting to $options doesn't error
->add('guru', EntityType::class, array(
'class' => User::class,
'choice_label' => 'username',
'data' => $options['guru']
))
and how I pass $options:
$form = $this->createForm(EditCategoryType::class, array('guru' => $guruName));
So with the help of #Juan I. Morales Pestana I found an answer, the only reason I've added the below as an answer rather than marking his as correct was because there seems to be a slight difference in how it works now..:
Controller now reads (Thanks to #Juan):
$category = $this->getDoctrine()->getRepository(Category::class)->find($id);
$category->setGuru($category->getGuru());
$form = $this->createForm(EditCategoryType::class, $category);
My EditCategoryType class:
->add('guru', EntityType::class, array(
'class' => User::class,
'choice_label' => 'username',
'mapped' => false,
'data' => $options['data']->getGuru()
))
updated twig template:
{{ form_widget(form.guru, { 'attr': {'class': 'form-control'} }) }}
<a href="{{ path('register_new', { idpackage: p.id }) }}" class="btn_packages">
//sends to form type the package id
$fromPackage = '';
if($request->query->get('idpackage')) {
$fromPackage = $request->query->get('idpackage');
}
$form = $this->createForm(RegisterFormType::class, $register, ['fromPackage' => $fromPackage]);
in formType set the param in options:
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => Register::class,
'fromPackage' => null
]);
}
->add('package',EntityType::class, [
'label' => 'Select one item',
'class' => Package::class,
'choice_label' => function($package) {
return $package->getTitle() . ' | crédits : ' . $package->getAmount();
},
'attr' => ['class' => 'input-text', ],
'placeholder' => '...',
'required' => false,
'choice_attr' => function($package) use ($idFromPackage) {
$selected = false;
if($package->getId() == $idFromPackage) {
$selected = true;
}
return ['selected' => $selected];
},
])
$parentCategory = $categoryRepository->repository->find(2);
$category = new Category();
$category->setParentCategory(parentCategory);
$form = $this->createForm(CategoryType::class, $category);
we chose the predefined top category, it works if you use it this way.
try this :
empty_data documentation
As I said in my comments you are doing something wrong. I will explain all the process:
calling the form in the controller
$person = new Person();
$person->setName('My default name');
$form = $this->createForm('AppBundle\Form\PersonType', $person);
$form->handleRequest($request);
then the createForm function is executed here is the code
Symfony\Bundle\FrameworkBundle\Controller\ControllerTrait
protected function createForm($type, $data = null, array $options = array())
{
return $this->container->get('form.factory')->create($type, $data, $options);
}
As you can see the data or options are nos setted directly in the form, another function is called and then the form is created
This is the result when I make a dump inside the PersonType
PersonType.php on line 20:
array:35 [▼
"block_name" => null
"disabled" => false
"label" => null
"label_format" => null
"translation_domain" => null
"auto_initialize" => true
"trim" => true
"required" => true
"property_path" => null
"mapped" => true
"by_reference" => true
"inherit_data" => false
"compound" => true
"method" => "POST"
"action" => ""
"post_max_size_message" => "The uploaded file was too large. Please try to upload a smaller file."
"error_mapping" => []
"invalid_message" => "This value is not valid."
"invalid_message_parameters" => []
"allow_extra_fields" => false
"extra_fields_message" => "This form should not contain extra fields."
"csrf_protection" => true
"csrf_field_name" => "_token"
"csrf_message" => "The CSRF token is invalid. Please try to resubmit the form."
"csrf_token_manager" => CsrfTokenManager {#457 ▶}
"csrf_token_id" => null
"attr" => []
"data_class" => "AppBundle\Entity\Person"
"empty_data" => Closure {#480 ▶}
"error_bubbling" => true
"label_attr" => []
"upload_max_size_message" => Closure {#478 ▶}
"validation_groups" => null
"constraints" => []
"data" => Person {#407 ▼ // Here is the data!!!
-id: null
-name: "My default name"
-salary: null
-country: null
}
]
As you can see the data is indexed at data so that is the reason why you get an undefined index error
So the proper way is to set the entity value from the controller or use your form as a service and call the repository and set the value using the data option which has not changed since version 2. My point is that you are using the form wrong.
Please change your code.
Hope it help
EDITED IN THE SYMFONY 4 WAY(with out namespaces bundles)
Let's see please, I have a Person Entity with a name just for this example
The controller
$person = new Person(); //or $personsRepository->find('id from request')
$person->setName('My default name');
$form = $this->createForm(PersonType::class, $person);
$form->handleRequest($request);
The form
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('name',TextType::class,[
//'data' => 'aaaaa' // <= this works too
]);
}
The options array value which proves that you are accessing wrong
PersonType.php on line 20:
array:35 [▼
"block_name" => null
"disabled" => false
"label" => null
"label_format" => null
"translation_domain" => null
"auto_initialize" => true
"trim" => true
"required" => true
"property_path" => null
"mapped" => true
"by_reference" => true
"inherit_data" => false
"compound" => true
"method" => "POST"
"action" => ""
"post_max_size_message" => "The uploaded file was too large. Please try to upload a smaller file."
"error_mapping" => []
"invalid_message" => "This value is not valid."
"invalid_message_parameters" => []
"allow_extra_fields" => false
"extra_fields_message" => "This form should not contain extra fields."
"csrf_protection" => true
"csrf_field_name" => "_token"
"csrf_message" => "The CSRF token is invalid. Please try to resubmit the form."
"csrf_token_manager" => CsrfTokenManager {#457 ▶}
"csrf_token_id" => null
"attr" => []
"empty_data" => Closure {#480 ▶}
"error_bubbling" => true
"label_attr" => []
"upload_max_size_message" => Closure {#478 ▶}
"validation_groups" => null
"constraints" => []
"data" => Person {#407 ▼
-id: null
-name: "My default name" //Here is the data
-salary: null
-country: null
}
]
AppBundle is just another folder in my folder structure. Be pleased to test your self. The second parameter to the formCreate function is the entity or data not the options you are thinking that the options is the data.

extbase query result object values null

I have an extension, that works fine on TYPO3 6.2 and 7.4. I try to run ist on TYPO3 8.7.
The problem is, that the values of my database result object are null except uid and pid.
I use $this->subjectRepository->findAll(); and I tried to use individual queries. The result is the same.
$query = $this->createQuery();
$query->statement('SELECT * FROM tx_libconnect_domain_model_subject WHERE deleted = 0 AND hidden = 0');
$query->execute();
This is the dump of the query:
TYPO3\CMS\Extbase\Persistence\Generic\Queryprototypeobject
type => protected'Sub\Libconnect\Domain\Model\Subject' (35 chars)
objectManager => protectedTYPO3\CMS\Extbase\Object\ObjectManagersingletonobjectfiltered
dataMapper => protectedTYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMappersingletonobjectfiltered
persistenceManager => protectedTYPO3\CMS\Extbase\Persistence\Generic\PersistenceManagersingletonobjectfiltered
qomFactory => protectedTYPO3\CMS\Extbase\Persistence\Generic\Qom\QueryObjectModelFactorysingletonobjectfiltered
source => protectedTYPO3\CMS\Extbase\Persistence\Generic\Qom\Selectorprototypeobject
nodeTypeName => protected'Sub\Libconnect\Domain\Model\Subject' (35 chars)
selectorName => protected'tx_libconnect_domain_model_subject' (34 chars)
constraint => protectedNULL
statement => protectedTYPO3\CMS\Extbase\Persistence\Generic\Qom\Statementprototypeobject
statement => protected'SELECT * FROM tx_libconnect_domain_model_subject WHERE deleted = 0 AND hidde
n = 0' (81 chars)
boundVariables => protectedarray(empty)
orderings => protectedarray(empty)
limit => protectedNULL
offset => protectedNULL
querySettings => protectedTYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettingsprototypeobject
respectStoragePage => protectedTRUE
storagePageIds => protectedarray(1 item)
ignoreEnableFields => protectedFALSE
enableFieldsToBeIgnored => protectedarray(empty)
includeDeleted => protectedFALSE
respectSysLanguage => protectedFALSE
languageOverlayMode => protected'1' (1 chars)
languageMode => protected'content_fallback' (16 chars)
languageUid => protected0 (integer)
usePreparedStatement => protectedFALSE
useQueryCache => protectedTRUE
The dump of the result object on TYPO3 8.7:
object(Sub\Libconnect\Domain\Model\Subject)#886 (10) { ["title":protected]=> NULL ["dbisid":protected]=> NULL ["ezbnotation":protected]=> NULL ["uid":protected]=> int(2) ["_localizedUid":protected]=> int(2) ["_languageUid":protected]=> NULL ["_versionedUid":protected]=> int(2) ["pid":protected]=> int(1) ["_isClone":"TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject":private]=> bool(false) ["_cleanProperties":"TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject":private]=> array(5) { ["title"]=> NULL ["dbisid"]=> NULL ["ezbnotation"]=> NULL ["uid"]=> int(2) ["pid"]=> int(1) } }
On TYPO3 6.2:
object(Sub\Libconnect\Domain\Model\Subject)#1078 (10) { ["title":protected]=> string(29) "Allgemein / Fachübergreifend" ["dbisid":protected]=> string(2) "28" ["ezbnotation":protected]=> string(2) "AZ" ["uid":protected]=> int(2) ["_localizedUid":protected]=> int(2) ["_languageUid":protected]=> NULL ["_versionedUid":protected]=> int(2) ["pid":protected]=> int(1) ["_isClone":"TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject":private]=> bool(false) ["_cleanProperties":"TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject":private]=> array(5) { ["title"]=> string(29) "Allgemein / Fachübergreifend" ["dbisid"]=> string(2) "28" ["ezbnotation"]=> string(2) "AZ" ["uid"]=> int(2) ["pid"]=> int(1) } }
Do you have any idea? Thanks a lot.
Sounds like the TCA is not valid.
There were some changes in TCA in the last major updates, e.g.:
The required field "renderType" when using a select
You have to use the tablename as filename for the TCA definitions
You need to move the TCA file for each table into the folder Configuration/TCA
You can see the TCA reference here: https://docs.typo3.org/typo3cms/TCAReference/

How to get the email's user from facebook apps

I am trying to get information's user from my Facebook app.
I am using the OAuthUserProvider to get the response data :
array(10) { ["id"]=> string(17) "xxxx" ["first_name"]
=> string(6) "xx" ["gender"]
=> string(4) "male" ["last_name"]
=> string(6) "xx" ["link"]
=> string(62) "https://www.facebook.com/app_scoped_user_id/102xxxx4640725/" ["locale"]
=> string(5) "en_US" ["name"]
=> string(13) "xx xx" ["timezone"]
=> int(1) ["updated_time"]=> string(24) "2014-08-17T21:12:52+0000" ["verified"]
=> bool(true) }
It is missing the email and other information. The problem is from my app because when I use other apps it works well. Should I modify my app's setting to get that missed information?

Create Account Paypal API

I tried to implement Create Account API of paypal with the following sample parameters:
accountType=Premier&addressType.line1=Real+St&addressType.city=San+Jose&addressType.postalCode=92274&addressType.countryCode=US&addressType.state=California&citizenshipCountryCode=US&contactPhoneNumber=123-456-1234&homePhoneNumber=123-456-1234&mobilePhoneNumber=123-456-1234&currencyCode=USD&dateOfBirth=1970-01-01Z&emailAddress=test.test%40gmail.com&nameType.salutation=Miss&nameType.firstName=Malou&nameType.lastName=Perez&nameType.suffix=Sr&preferredLanguageCode=en_US&registrationType=Web&requestEnvelope.errorLanguage=en_US&requestEnvelope.detailLevel=ReturnAll&suppressWelcomeEmail=1&createAccountWebOptionsType.useMiniBrowser=0&createAccountWebOptionsType.returnUrl=http%3A%2F%2Fwww.testurlonly.com&createAccountWebOptionsType.reminderEmailFrequency=NONE&createAccountWebOptionsType.confirmEmail=0
To make it clearer, parameters when put in array has the following values:
$parameters = array(
'accountType' => 'Premier',
'addressType.line1' => 'Real St',
'addressType.city' => 'San Jose',
'addressType.postalCode' => '92274',
'addressType.countryCode' => 'US',
'addressType.state' => 'California',
'citizenshipCountryCode' => 'US',
'contactPhoneNumber' => '123-456-1234',
'homePhoneNumber' => '123-456-1234',
'mobilePhoneNumber' => '123-456-1234',
'currencyCode' => 'USD',
'dateOfBirth' => '1970-01-01Z',
'emailAddress' => 'test.test#gmail.com',
'nameType.salutation' => 'Miss',
'nameType.firstName' => 'Malou',
'nameType.lastName' => 'Perez',
'nameType.suffix' => 'Sr',
'preferredLanguageCode' => 'en_US',
'registrationType' => 'Web',
'requestEnvelope.errorLanguage' => 'en_US',
'requestEnvelope.detailLevel' => 'ReturnAll',
'suppressWelcomeEmail' => true,
'createAccountWebOptionsType.useMiniBrowser' => false,
'createAccountWebOptionsType.returnUrl' => 'http://www.testurlonly.com',
'createAccountWebOptionsType.reminderEmailFrequency' => 'NONE',
'createAccountWebOptionsType.confirmEmail' => false
);
here is the response of AdaptiveAccounts/CreateAccount api (converted to array):
array(18) {
["responseEnvelope.timestamp"]=>
string(29) "2013-01-07T21:33:01.984-08:00"
["responseEnvelope.ack"]=>
string(7) "Failure"
["responseEnvelope.correlationId"]=>
string(13) "ae7c9d245cabf"
["responseEnvelope.build"]=>
string(7) "4055066"
["error(0).errorId"]=>
string(6) "580029"
["error(0).domain"]=>
string(8) "PLATFORM"
["error(0).subdomain"]=>
string(11) "Application"
["error(0).severity"]=>
string(5) "Error"
["error(0).category"]=>
string(11) "Application"
["error(0).message"]=>
string(40) "Missing required request parameter: name"
["error(0).parameter(0)"]=>
string(4) "name"
["error(1).errorId"]=>
string(6) "580029"
["error(1).domain"]=>
string(8) "PLATFORM"
["error(1).subdomain"]=>
string(11) "Application"
["error(1).severity"]=>
string(5) "Error"
["error(1).category"]=>
string(11) "Application"
["error(1).message"]=>
string(43) "Missing required request parameter: address"
["error(1).parameter(0)"]=>
string(7) "address"
}
Please enlighten me why it says "Missing required request parameter: address" and "Missing required request parameter: name".
I was thinking addressType.line1=Real+St&addressType.city=San+Jose&addressType.postalCode=92274&addressType.countryCode=US&addressType.state=California
refers to address
and
nameType.salutation=Miss&nameType.firstName=Malou&nameType.lastName=Perez&nameType.suffix=Sr
refers to name.
Thank you.
Instead of nameType., use name.. Thus, we have
name.firstName, name.lastName, name.salutation and name.suffix
and I removed name.salutation because i do not have any idea on what the correct values for this field are.
For addressType., i replace it with adress. Moreover, address.state must have the state code and not the state name.
I also figured out that paypal returns 580022 Invalid request parameter for fields with incorrect format and values. We can not put dummy data for postalCode, city and state that are not existing.

Zend_Form not showing error message

I have the following ZF form element.
$this->addElement('text', 'price', array(
'required' => true,
'label' => 'Price:',
'attribs' => array(
'title' => 'Please enter the value of your artwork'),
'filters' => array('Currency'),
'validators' => array(
array('NotEmpty', true, array(
'messages' => array(
Zend_Validate_NotEmpty::IS_EMPTY =>
"You must enter your artworks price"))),
array('Float', true, array(
'messages' => array(
Zend_Validate_Float::INVALID =>
"You must enter a valid price",
Zend_Validate_Float::NOT_FLOAT =>
"You must enter a valid price"))),
array('GreaterThan', true, array(
'min' => 0.99,
'messages' => array(
Zend_Validate_GreaterThan::NOT_GREATER =>
"You must enter a value of £1.00 or more"))))
));
The last validator is Zend_Validate_GreaterThan which has been set an error message, my problem is that the error message is not displayed on the form when this validator fails. All I get rendered is an empty unordered list!!
<ul>
<li></li>
</ul>
When I check the messages output by zend_form I get the error and the message.
array(1) {
["price"]=>
array(1) {
["notGreaterThan"]=>
string(39) "You must enter a value of £1.00 or more"
}
}
Does anyone know why the message is not being rendered on the form?
Many thanks in advance
Garry
EDIT
The only decorator I am using is a viewscript to render the form, on the form I have.
$this->setDecorators(array(
array('ViewScript', array('viewScript' => 'forms/add-item.phtml'))
));
and the viewscript itself.
$attribFilterObj = new Freedom_Zend_Filter_HtmlAttribs();
$attribs = $attribFilterObj->filter($this->element->getAttribs());
?>
<form <?php echo $attribs; ?>>
<dl>
<?php echo $this->element->ArtworkTitle->title->render(); ?>
<?php echo $this->element->ArtworkDescription->description->render(); ?>
<?php echo $this->element->price->render(); ?>
<?php echo $this->element->Genres->render(); ?>
<?php echo $this->element->image->render(); ?>
<?php echo $this->element->add->render(); ?>
</dl>
</form>
EDIT
The output of the var_dump is as follows
array(5) {
["Zend_Form_Decorator_ViewHelper"]=>
object(Zend_Form_Decorator_ViewHelper)#157 (6) {
["_buttonTypes":protected]=>
array(3) {
[0]=>
string(24) "Zend_Form_Element_Button"
[1]=>
string(23) "Zend_Form_Element_Reset"
[2]=>
string(24) "Zend_Form_Element_Submit"
}
["_helper":protected]=>
NULL
["_placement":protected]=>
string(6) "APPEND"
["_element":protected]=>
NULL
["_options":protected]=>
array(0) {
}
["_separator":protected]=>
string(2) "
"
}
["Zend_Form_Decorator_Errors"]=>
object(Zend_Form_Decorator_Errors)#158 (4) {
["_placement":protected]=>
string(6) "APPEND"
["_element":protected]=>
NULL
["_options":protected]=>
array(0) {
}
["_separator":protected]=>
string(2) "
"
}
["Zend_Form_Decorator_Description"]=>
object(Zend_Form_Decorator_Description)#159 (6) {
["_escape":protected]=>
NULL
["_placement":protected]=>
string(6) "APPEND"
["_tag":protected]=>
NULL
["_element":protected]=>
NULL
["_options":protected]=>
array(2) {
["tag"]=>
string(1) "p"
["class"]=>
string(11) "description"
}
["_separator":protected]=>
string(2) "
"
}
["Zend_Form_Decorator_HtmlTag"]=>
object(Zend_Form_Decorator_HtmlTag)#160 (7) {
["_encoding":protected]=>
NULL
["_placement":protected]=>
NULL
["_tag":protected]=>
NULL
["_tagFilter":protected]=>
NULL
["_element":protected]=>
NULL
["_options":protected]=>
array(2) {
["tag"]=>
string(2) "dd"
["id"]=>
array(1) {
["callback"]=>
array(2) {
[0]=>
string(22) "Zend_Form_Element_Text"
[1]=>
string(16) "resolveElementId"
}
}
}
["_separator":protected]=>
string(2) "
"
}
["Zend_Form_Decorator_Label"]=>
object(Zend_Form_Decorator_Label)#161 (6) {
["_placement":protected]=>
string(7) "PREPEND"
["_tag":protected]=>
NULL
["_tagClass":protected]=>
NULL
["_element":protected]=>
NULL
["_options":protected]=>
array(1) {
["tag"]=>
string(2) "dt"
}
["_separator":protected]=>
string(2) "
"
}
}
This is sometimes caused by forgetting to include 'Errors' in the form decorator for the element. If you're using a custom decorator, check that first.
a bit old but check this site http://zendguru.wordpress.com/2008/12/04/handling-zend-framework-form-error-messages/
i believe you have to get the error messages yourselve like and then print them
$errorsMessages = $this->form->getMessages();
I had the same problem, I was only using a ViewScript as you are. This solved it:
($this is in the form class I created)
$this->setDecorators(array(
array('ViewScript',
array('viewScript' => '/formElementViewscripts/editRoughDraft/_form.phtml')),
'Form'
));
You must also add the default 'Form' decorator to your form if you want to be able to receive those messages. I tried looking through the code but I couldn´t pinpoint exactly why.