Feature #39305

Implement mixin support

Added by Tymoteusz Motylewski 11 months ago. Updated 18 days ago.

Status:Accepted Start date:2012-07-26
Priority:Should have Due date:
Assignee:- % Done:

0%

Category:Extbase
Target version:Extbase 6.3
Has patch:No Tags:
Votes: 0

Description

It would be nice to have at last basic mixins support in Extbase.
Using mixins it would be possible to add php "snippet" to extisting class.

1. Conflicts (between mixins, or between mixin and original class) will not be resolved and will result in error.

2. Mixin code will be added to the end of the original class file, and a file with new version of this class will be stored.

3. Object Manager has to include file with mixin instead of original file.

4. One class can have multiple mixins attached.

5. The configuration might look like this:

config.tx_extbase {
    objects {
        Tx_Extbase_Domain_Model_FrontendUser {
            className = Tx_Extension1_Domain_Model_User
            mixins {
                tx_genderExtension {
                    className = Tx_genderExtension_Domain_Mixin_User
                }
                tx_dateOfBirthExtension {
                    className = Tx_dateOfBirthExtension_Domain_Mixin_User
                }
            }
        }
        Tx_Extension1_Domain_Model_User {
            mixins {
                tx_companyExtension {
                    className = Tx_companyExtension_Domain_Mixin_User
                }
            }
        }
        Tx_Extension2_Domain_Model_User {
            mixins {
                tx_petExtension {
                    className = Tx_petExtension_Domain_Mixin_User
                }
            }
        }
    }
}

6. Under discussion is how to handle inheritance of mixed classes and overriding mixed classes with DI.


Related issues

duplicates Extbase MVC Framework - Feature #13746: Make Domain Models easier extensible On Hold 2011-03-10

History

Updated by Tymoteusz Motylewski 11 months ago

Some questions regarding 6)
a)Should mixins configured for parent class be available in child class? (no dependecy injection)
b)Should mixins configured for class0 be also applied to class1 which overrides it by dependency injection ? ( $om->create(class0); is used )
c) Should class 1 which overrides class 0 (by DI), but does not extends 0, get mixins from class 0
(when called directly)? $om->create(class1);

Updated by Ingo Pfennigstorf 9 months ago

  • Status changed from New to Needs Feedback
  • Target version deleted (6.0.0)

What is the current state of the discussion? Will there be mixins in 6.1?

Updated by Anja Leichsenring 6 months ago

  • Status changed from Needs Feedback to Accepted
  • Assignee deleted (Tymoteusz Motylewski)

Updated by Alexander Schnitzler about 1 month ago

  • Target version set to Extbase 6.2

Updated by Anja Leichsenring 18 days ago

  • Target version changed from Extbase 6.2 to Extbase 6.3

Also available in: Atom PDF