Kajona\System\System\ObjectBuilder

Class which can create new objects and resolves all properties with an @inject annotation. So you get an object containing all needed services without the need to manually use constructor or setter injection

Synopsis

class ObjectBuilder {
  • // constants
  • const ANNOTATION_INJECT = "@inject";
}

Tasks

Line Task
46+ the constructor call should get obsolte. by convention the constructor shouldn't require access to properties injected by the dependency container. Currently used e.g. in AdminController.

Constants

Name Value
ANNOTATION_INJECT "@inject"

Members

protected

Methods

public

  • __construct()
  • factory() — Creates a new object and resolves all properties with an inject annotation from the DI container. Through this method you can use the dependencies also in the constructor. If you create the object otherwise you can NOT use the dependencies inside the constructor
  • resolveDependencies() — Can be used to inject the properties if you have already an object. Normally you want to use the factory method