我想访问我的技术人员的孙子'实体
层次:
实体用户 - > PersonalDetails
实体技术员 - >用户
尝试时
/** AdminBundle/Admin/TechnicianAdmin.php */
$formMapper
->add('user.personalDetails','sonata_type_admin',[
'delete'=>false
]);
我收到此错误
属性" personalDetailsuser"也不是其中一种方法" getPersonalDetailsuser()"," personalDetailsuser()"," isPersonalDetailsuser()"," hasPersonalDetailsuser()&# 34;," __ get()"在课堂上存在并具有公共访问权限" AppBundle \ Entity \ Technician"。
然而尝试这个:
/** AdminBundle/Admin/UserAdmin.php */
$formMapper
->add('personalDetails','sonata_type_admin',[
'delete'=>false
]);
Everythings按预期工作100%。我可以在我的UserAdmin类中将PersonalDetails嵌入sonata_type_admin
,但不能在我的TechnicianAdmin类[包含User对象]中嵌入。如何在我的TechnicianAdmin课程中嵌入PersonalDetails?我希望我清楚,请让我知道任何困惑。
答案 0 :(得分:0)
您可以尝试将getter和setter添加到实体/** AppBundle/Entity/Technician.php */
// getter
getPersonalDetails () {
return $this->getUser()->getPersonalDetails();
}
// setter
setPersonalDetails(PersonalDetails $personalDetails) {
$this->getUser()->setPersonalDetails($personalDetails);
}
,例如
TechnicianAdmin
并在/** AdminBundle/Admin/TechnicianAdmin.php */
$formMapper
->add('personalDetails','sonata_type_admin',[
'delete'=>false
]);
:
function traverse_directory(entry) {
let reader = entry.createReader();
// Resolved when the entire directory is traversed
return new Promise((resolve_directory) => {
var iteration_attempts = [];
(function read_entries() {
// According to the FileSystem API spec, readEntries() must be called until
// it calls the callback with an empty array. Seriously??
reader.readEntries((entries) => {
if (!entries.length) {
// Done iterating this particular directory
resolve_directory(Promise.all(iteration_attempts));
} else {
// Add a list of promises for each directory entry. If the entry is itself
// a directory, then that promise won't resolve until it is fully traversed.
iteration_attempts.push(Promise.all(entries.map((entry) => {
if (entry.isFile) {
// DO SOMETHING WITH FILES
return entry;
} else {
// DO SOMETHING WITH DIRECTORIES
return traverse_directory(entry);
}
})));
// Try calling readEntries() again for the same dir, according to spec
read_entries();
}
}, errorHandler );
})();
});
}
traverse_directory(my_directory_entry).then(()=> {
// AT THIS POINT THE DIRECTORY SHOULD BE FULLY TRAVERSED.
});