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

Edit template references non-implemented version model #553

Open
3 tasks done
gmpf opened this issue Oct 16, 2020 · 2 comments
Open
3 tasks done

Edit template references non-implemented version model #553

gmpf opened this issue Oct 16, 2020 · 2 comments
Assignees
Milestone

Comments

@gmpf
Copy link
Contributor

gmpf commented Oct 16, 2020

Checklist before I submit this issue report

I confirm that:

My environment is:

Key Value Comments
PHP version: 7.2
Contao version: 4.4.50
DC_General version: 2.1.8 Patches from PR #552 applied
Installation via composer: yes

Issue description

Editing a record based on a DCA that uses versioning causes this exception:

Attempted to call an undefined method named "isCurrent" of class "ContaoCommunityAlliance\DcGeneral\Data\DefaultModel".

Steps to reproduce

  1. Change any DCA that uses versioning to DC_General.
  2. Apply the patches from Fix version data retrieval in DefaultDataProvider #552 to even get to this issue.
  3. Edit any record.

Cause/Background

dcbe_general_edit.html5 includes the following code added in b909a20:

<?php foreach($this->versions as $objVersion): /** @var \ContaoCommunityAlliance\DcGeneral\Data\VersionModelInterface $objVersion */ ?>
	<option value="<?php echo $objVersion->getId(); ?>"<?php if($objVersion->isCurrent()): ?> selected="selected"<?php endif; ?>>
	<?php echo $GLOBALS['TL_LANG']['MSC']['version']; ?> <?php echo $objVersion->getVersion(); ?> (<?php echo $this->parseDate($GLOBALS['TL_CONFIG']['datimFormat'], $objVersion->getDateTime()->getTimestamp()); ?>)
	/* ... */
	</option>
<?php endforeach; ?>

$this->versions is assumed to be an instance of VersionModelInterface, however, there is no implementation of that interface. What is actually passed to the template is a DefaultModel.

As this is my first time working with DC_General, this initially caused me to think that versioning support is so far incomplete. However, after applying the fixes provided in PR #552 and reverting the template code to what it was before b909a20, versioning seems to be available without any issue.

As I'm not particularly deep into the DC_General lore, I don't know whether this would be considered a bug or simply a result of versioning support being a work in progress.

@zonky2 zonky2 added this to the 2.1.9 milestone Oct 19, 2020
@zonky2 zonky2 added the bug label Oct 19, 2020
@discordier
Copy link
Member

Yes, versioning is not fully implemented yet.

We discussed this internally and came to the following conclusions:

  • We disable versioning for 2.1.9 and trigger a warning that the flag is being ignored.
  • We implement the missing parts of version handling in 2.2.0.

@zonky2 zonky2 added enhancement and removed bug labels Nov 11, 2020
@zonky2 zonky2 modified the milestones: 2.1.9, 2.2.0 Nov 11, 2020
baumannsven added a commit that referenced this issue Nov 11, 2020
…e versioning comes as feature in a later version. #553
baumannsven added a commit that referenced this issue Nov 11, 2020
This is a bugfix release.
This release has:
- Disable the versioning in the legacy data definition if is enable. The versioning comes as feature in a later version. #553
- Add missing select in DefaultDataProvider#getVersion()
- Fix typo in active version retrieval
- Fix versions fetch in DefaultDataProvider
- Fix typo: 'tl_version.formTable' -> 'fromTable'
- Add exception if palettes null in the palette collection #556
- Change operations to fix DBAL error see #549
- Add fallback for id property in tree picker
- Fix the amount for filter all in the default limit element
baumannsven added a commit that referenced this issue Nov 11, 2020
This is a bugfix release.
This release has:
- Disable the versioning in the legacy data definition if is enable. The versioning comes as feature in a later version. #553
- Add missing select in DefaultDataProvider#getVersion()
- Fix typo in active version retrieval
- Fix versions fetch in DefaultDataProvider
- Fix typo: 'tl_version.formTable' -> 'fromTable'
- Add exception if palettes null in the palette collection #556
- Change operations to fix DBAL error see #549
- Add fallback for id property in tree picker
- Fix the amount for filter all in the default limit element
baumannsven added a commit that referenced this issue Nov 11, 2020
This is a bugfix release.
This release has:
- Disable the versioning in the legacy data definition if is enable. The versioning comes as feature in a later version. #553
- Add missing select in DefaultDataProvider#getVersion()
- Fix typo in active version retrieval
- Fix versions fetch in DefaultDataProvider
- Fix typo: 'tl_version.formTable' -> 'fromTable'
- Add exception if palettes null in the palette collection #556
- Change operations to fix DBAL error see #549
- Add fallback for id property in tree picker
- Fix the amount for filter all in the default limit element
@zonky2
Copy link
Contributor

zonky2 commented May 10, 2022

We implement the missing parts of version handling in 2.2.0.

=> We implement the missing parts of version handling (probably) in 2.3.0.

@zonky2 zonky2 modified the milestones: 2.2.0, 2.3.0 May 10, 2022
@zonky2 zonky2 modified the milestones: 2.3.0, 2.3.1 Oct 31, 2023
@zonky2 zonky2 modified the milestones: 2.3.1, 2.2.3, 2.4.0 Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants