Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protected members are available only via getters. #1089

Merged

Conversation

rishadomar
Copy link
Contributor

Q A
Bug fix? yes/no
New feature? yes/no
BC breaks? no
Deprecations? yes/no
Fixed tickets #...

@dpfaffenbauer dpfaffenbauer added this to the 2.0.9 milestone Sep 5, 2019
@dpfaffenbauer dpfaffenbauer removed their assignment Sep 5, 2019
@@ -72,12 +73,12 @@ public function getDataForEditmode($data, $object = null, $params = [])
list('objectData' => $objectData['data'], 'metaData' => $objectData['metaData']) = $editmodeHelper->getDataForObject($embeddedObject);

$objectData['id'] = $embeddedObject->getId();
$allowedKeys = ['o_published', 'o_key', 'o_id', 'o_modificationDate', 'o_creationDate', 'o_classId', 'o_locked', 'o_type', 'o_parentId', 'o_userOwner', 'o_userModification'];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not really sure how that should solve the problem.

why not simply like this:

$objectData['general'] = [
                'index' => $embeddedObject->getIndex(),
                'o_published' => $embeddedObject->getPublished(),
                'o_key' => $embeddedObject->getKey(),
                'o_id' => $embeddedObject->getId(),
                'o_modificationDate' => $embeddedObject->getModificationDate(),
                'o_creationDate' => $embeddedObject->getCreationDate(),
                'o_classId' => $embeddedObject->getClassId(),
                'o_className' => $embeddedObject->getClassName(),
                'o_locked' => $embeddedObject->getLocked(),
                'o_type' => $embeddedObject->getType(),
                'o_parentId' => $embeddedObject->getParentId(),
                'o_userOwner' => $embeddedObject->getUserOwner(),
                'o_userModification' => $embeddedObject->getUserModification()
            ];

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes sure - much neater!
It worked because the other members were public but I like using the getters instead.
Also, getIndex() returns 0 unless you save and reload the object. But if you close the object and view again it's reverted to 0.
So I added the ++$i.
(Also users prefer index to start with 1 instead of 0)

@dpfaffenbauer dpfaffenbauer merged commit bc4330b into coreshop:2.0 Sep 6, 2019
@dpfaffenbauer
Copy link
Member

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants