Skip to content

Commit

Permalink
fixed #1 - Refactor Object to DataObject
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Fasching committed Jun 15, 2018
1 parent e06d2f0 commit 949790e
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
namespace Elements\Bundle\ExportToolkitBundle\ExportService\AttributeClusterInterpreter;

use Elements\Bundle\ExportToolkitBundle\Traits\LoggerAwareTrait;
use Pimcore\Model\Object\AbstractObject;
use Pimcore\Model\DataObject\AbstractObject;
use Psr\Log\NullLogger;

abstract class AbstractAttributeClusterInterpreter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

namespace Elements\Bundle\ExportToolkitBundle\ExportService\AttributeClusterInterpreter;

use Pimcore\Model\Object\AbstractObject;
use Pimcore\Model\DataObject\AbstractObject;

class DefaultCsv extends AbstractAttributeClusterInterpreter
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

namespace Elements\Bundle\ExportToolkitBundle\ExportService\AttributeClusterInterpreter;

use Pimcore\Model\Object\AbstractObject;
use Pimcore\Model\DataObject\AbstractObject;

class DefaultJson extends AbstractAttributeClusterInterpreter
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
namespace Elements\Bundle\ExportToolkitBundle\ExportService\AttributeClusterInterpreter;

use Elements\Bundle\ExportToolkitBundle\SimpleXMLExtended;
use Pimcore\Model\Object\AbstractObject;
use Pimcore\Model\DataObject\AbstractObject;

class DefaultXml extends AbstractAttributeClusterInterpreter
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
namespace Elements\Bundle\ExportToolkitBundle\ExportService\Filter;

use Elements\Bundle\ExportToolkitBundle\ExportService\IFilter;
use Pimcore\Model\Object\AbstractObject;
use Pimcore\Model\DataObject\AbstractObject;

class DefaultFilter implements IFilter
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

namespace Elements\Bundle\ExportToolkitBundle\ExportService;

use Pimcore\Model\Object\Listing;
use Pimcore\Model\DataObject\Listing;

interface IListModificator
{
Expand Down
24 changes: 13 additions & 11 deletions src/Elements/Bundle/ExportToolkitBundle/ExportService/Worker.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@
use Elements\Bundle\ExportToolkitBundle\Traits\LoggerAwareTrait;
use Pimcore\Log\ApplicationLogger;
use Pimcore\Logger;
use Pimcore\Model\Object\AbstractObject;
use Pimcore\Model\Object\Localizedfield;
use Pimcore\Model\DataObject\AbstractObject;
use Pimcore\Model\DataObject\ClassDefinition;
use Pimcore\Model\DataObject\Concrete;
use Pimcore\Model\DataObject\Localizedfield;
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;

Expand Down Expand Up @@ -58,10 +60,10 @@ public function __construct(Configuration $workerConfig)
$classId = trim($workerConfig->getConfiguration()->general->pimcoreClass);

if ($classId) {
$class = \Pimcore\Model\Object\ClassDefinition::getById($classId);
$this->pimcoreClass = trim('\\Pimcore\\Model\\Object\\' . ucfirst($class->getName()));
$class = ClassDefinition::getById($classId);
$this->pimcoreClass = trim('\\Pimcore\\Model\\DataObject\\' . ucfirst($class->getName()));
} else {
$this->pimcoreClass = '\\Pimcore\\Model\\Object\\AbstractObject';
$this->pimcoreClass = '\\Pimcore\\Model\\DataObject\\AbstractObject';
}

$workerConfigClassName = trim($workerConfig->getConfiguration()->general->filterClass);
Expand Down Expand Up @@ -222,30 +224,30 @@ public function setUpExport()
}

/**
* @return \Pimcore\Model\Object\Listing\Concrete
* @return \Pimcore\Model\DataObject\Listing\Concrete
*/
public function getObjectList()
{
if ($this->pimcoreClass == 'Object_Abstract' || $this->pimcoreClass == 'AbstractObject'
|| $this->pimcoreClass == '\\Pimcore\\Model\\Object\\AbstractObject') {
$listClassName = '\\Pimcore\\Model\\Object\\Listing';
|| $this->pimcoreClass == '\\Pimcore\\Model\\DataObject\\AbstractObject') {
$listClassName = '\\Pimcore\\Model\\DataObject\\Listing';
} else {
$listClassName = $this->pimcoreClass . '\\Listing';
}

/**
* @var $objects \Pimcore\Model\Object\Listing\Concrete|\Pimcore\Model\Object\Listing\Dao
* @var $objects \Pimcore\Model\DataObject\Listing\Concrete|\Pimcore\Model\DataObject\Listing\Dao
*/
$objects = new $listClassName();
$objects->setUnpublished(true);
$objects->setObjectTypes(['object', 'folder', 'variant']);
if ($this->workerConfig->getConfiguration()->general->queryLanguage) {
$objects->setLocale($this->workerConfig->getConfiguration()->general->queryLanguage);
if ($objects instanceof \Pimcore\Model\Object\Listing\Concrete) {
if ($objects instanceof Concrete) {
$objects->setIgnoreLocalizedFields(false);
}
} else {
if ($objects instanceof \Pimcore\Model\Object\Listing\Concrete) {
if ($objects instanceof Concrete) {
$objects->setIgnoreLocalizedFields(true);
}
}
Expand Down

0 comments on commit 949790e

Please sign in to comment.