Looks like there's a bug in Category::addChildCategory(), it'll only add objects that are already in the array.
Don't see a constructor so how do you instantiate Category? Got some generic wrapper class that consumes data and target class name and then figures out setter-names?
As for constructor, it is inferred. I configure the properties with some default values (just empty string or empty array). Then I'll set each property with the respective setters like this:
Yep. I have a Repository class for communicating with database, and that one will use a generic method that uses reflection to figure out the properties and methods to use for each property.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Looks like there's a bug in Category::addChildCategory(), it'll only add objects that are already in the array.
Don't see a constructor so how do you instantiate Category? Got some generic wrapper class that consumes data and target class name and then figures out setter-names?
Good catch. It's supposed to be a ! in there.
As for constructor, it is inferred. I configure the properties with some default values (just empty string or empty array). Then I'll set each property with the respective setters like this:
Yep. I have a Repository class for communicating with database, and that one will use a generic method that uses reflection to figure out the properties and methods to use for each property.