Hi there,
I was trying to override a DataObject class (as documented in https://pimcore.com/docs/pimcore/current/Development_Documentation/Extending_Pimcore/Overriding_Models.html)
My config.yaml looks like this:
`
pimcore:
models:
class_overrides:
'Pimcore\Model\DataObject\BlogEntry': 'App\Model\DataObject\BlogEntry'
`
and the App\Model\DataObject\BlogEntry class looks like this:
`
<?php
namespace App\Model\DataObject;
use Pimcore\Model\DataObject\BlogEntry\Listing as BlogEntryListing;
class BlogEntry extends \Pimcore\Model\DataObject\BlogEntry {
private function setShowOnHomepageParent(?bool $showOnHomepage)
{
parent::setShowOnHomepage($showOnHomepage);
}
/**
* Set showOnHomepage
* @param bool|null $showOnHomepage
* @return \App\Model\DataObject\BlogEntry
*/
// this method already exists and is meant to be overriden
public function setShowOnHomepage(?bool $showOnHomepage)
{
if ( $showOnHomepage == true ) {
// Get all blog entries that are not the current object
$temp_blog_entry_listing = new BlogEntryListing();
$temp_blog_entry_listing2->setCondition("id != ?", $this->getId());
$temp_blog_entry_listing->load();
// Set showOnHomepage to false on all those blog entries
foreach ( $temp_blog_entry_listing as $key => $blog_entry ) {
$blog_entry->setShowOnHomepageParent(false);
}
}
$this->setShowOnHomepageParent($showOnHomepage);
return $this;
}
}
`
Unfortunately when adding a new blogEntry object (in the admin panel via DataObjects) I get the following error message:
Attempted to load class "BlogEntry" from namespace "App\Model\DataObject". Did you forget a "use" statement for "Pimcore\Model\DataObject\BlogEntry"?
Server threw exception - could not perform action. Please reload the admin interface and try again.
What am I doing wrong?
Hello, all !
I am implementing my own login action and i need to implement user authentication programmatically. I checked a lot of information and tried couple of approaches, but any of them is not working. Could anyone help me with that ?
This is my code:
/**
* Login
*/
public function authAction(
Request $request,
AuthenticationManagerInterface $authenticationManager
) {
$username = $request->get('username');
$password = $request->get('password');
if (empty($username) && empty($password)) {
throw new NotFoundHttpException();
}
/** @var \Pimcore\Model\User $user */
$user = Authentication::authenticatePlaintext($username, $password);
if ($user) {
$authenticationManager->authenticate(new UsernamePasswordToken($user->getEmail(), null, 'demo_frontend', $user->getRoles()));
}
}
I have a user after "authenticatePlaintext", but when i call $authenticationManager->authenticate( i got redirecting to "login" action and user is authenticated as "anon.". How can i authenticate user as a user?
Thank you in advance
/var/www/html# bin/console pimcore:bundle:list
+---------------------------------+---------+-----------+-------------+---------------+----------+
| Bundle | Enabled | Installed | Installable | Uninstallable | Priority |
+---------------------------------+---------+-----------+-------------+---------------+----------+
| AlepLdapBundle | ✔ | ✔ | ❌ | ❌ | ✔ |
| PimcoreDataHubBundle | ✔ | ✔ | ❌ | ✔ | ✔ |
| PimcoreDataImporterBundle | ✔ | ✔ | ❌ | ❌ | ✔ |
| PimcoreEcommerceFrameworkBundle | ✔ | ✔ | ❌ | ✔ | ✔ |
+---------------------------------+---------+-----------+-------------+---------------+----------+
Legend: I?: Can be installed? UI?: Can be uninstalled? UP?: Can be updated?
Hello pimcore community
I just install pimcore-demo using docker images
I want to go to User Roles:
https://pimcore.com/docs/pimcore/current/Development_Documentation/Administration_of_Pimcore/Users_and_Roles.html
But I cannot find it?
Could you give me some hints?