sifix Posted July 12, 2007 Share Posted July 12, 2007 Hi, I am working mainly in the Accounting Bussiness and have programming as a hobby for a few years I have created a lot of things in Joomla and make small php application in php (out of joomla) For months now I have a big and hard, I think ambition. I want to Develop a Web Enterprise Resource Planning (ERP) and a Customer Relation Managment Application for my bussiness. I have been searching and I am trying to learn a lot of thing before I get started as I want to design it in order to be easily expanded and maintained later.. I want to create my one framework(s) studying other frameworks and create the bes for me.. I am looking for information and suggestions Things that I want are the following: I want to make use of MaxDB as it designed for heavy transactions and in accounting transactions are used constantly. (Do you know any framework to study that supports MaxDB?) Also I want a user to use the Administration area in order to create new dimensions in the database. For example, lets say we have a warehouse and stores a lot of products each category of product has each own caracteristics (clothes have colour but TV set don't etc). So when the user want to introduce a new category to create the characteristigs through gui. I have read a relatively post about ORM patterns in the forum ( http://www.phpfreaks.com/forums/index.php/topic,143691.0.html ) and I am studying now about ORM patterns. The above sure it involves code generation and I would like me to point me if you now where I can found resources in dynamic code generation in php. Moreover I will create objects such as the object Account but I want the user to add custom fields or allow user to inject custom code set new rules for validating or execute new functions. (this is important as things in legislation are constantly change) But I don't want the user to see all the class for the object Account. I want the object class to load the code that users have written. I thought of creating new extended class based on the object Account but how can I handle if I have 2 users that each of them have written their code to enhance the application and I want the code for both of them to work together simultaneously? I found the runkit package ( http://gr2.php.net/runkit ) and thought to be able to load the the code dynamically into the objects class. Do you have any suggestions? I also want the user to create custom forms, reports etc Do you suggest the generated code or the user code to store it in files or in the database in the applications settings table? Generally do you suggest me to store settings in the database or files in order to achieve best performance? Please suggest me frameworks patterns to look at thank you in advanced I know it is a very big and difficult project ??? and I ask a lot of things in here but I want to design it well before I get started :-\ .. Thank you in advance for your time.. Quote Link to comment Share on other sites More sharing options...
sifix Posted July 14, 2007 Author Share Posted July 14, 2007 Any suggestion? I know it is a big post.. Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted July 14, 2007 Share Posted July 14, 2007 The above sure it involves code generation and I would like me to point me if you now where I can found resources in dynamic code generation in php. You should not be generating any PHP code on the fly. Research "data driven design." Quote Link to comment Share on other sites More sharing options...
Buyocat Posted July 14, 2007 Share Posted July 14, 2007 I am actually working on a project right now to develop an ORM written in PHP, so I'd be happy to talk more about this issue with you. From your project description it definitely seems like an ORM is in order. First off let me suggest the book "Patterns of Enterprise Architecture" by Martin Fowler. It is incrediably on topic, and while expensive I believe it is worth every penny. It's a little hard to follow what you mean about injecting/compiling code. If you mean that you'd like to use a series of configuration files to drive the application then I am in full agreement. If you mean that you'd like to emulate the PHP exec function except using your own domain language then I would caution you. You cited validation as one example, and I think that could easily be moved to, say, a XML file. You could describe your objects and their validation schemes in the XML and have that parsed and the results used to drive the application. Then when changes were needed a client could simply submit a new XML file (which might be managed/written by some GUI interface). You also mention adding fields to an object. This is much more difficult, but is where a good ORM could come in handy. For instance if you have a configuration file describing an object's relationship to a table or set of tables then the client can change the state of the object by changing the configuration file. The only problem that arises is how the data object (built on top of an ORM) connects to the view/controller. At this point you might consider adding another mapping layer between the data object and view. I think it's clear that as this process plays out things get much more complicated. What's important then is to identify exactly what your needs are and any special cases. Lastly you talk about custom forms. I'm not sure what you mean by custom forms, but really in the context of the data objects described above I'm not sure why you would want them. My understanding is that if you had a data object (whose state was stored in a database) which was described in a configuration file then you could use that metadata to construct the appropriate forms. Thus any of the application's views could be generated through the metadata. This only raises the question of what and how much metadata you need to accomplish your goals. I'm currently working on a very similar problem at the moment. I have a business object which has getters/setters and need to construct a UI automatically based on metadata decorating the object. Some complications that I've run into are: 1) some fields require drop down menus to make sense of their values, so you'll need a mechanism to identify them and look up their human readable values (e.g. a user state field which maps to another table) 2) objects update in different ways. For instance, some objects update when the set method is called. i.e. setFoo() immediately calls the db and sets foo. However other objects require a "save" method to be called after making changes. You may need to handle both cases within the same model (it is in fact possible). 3) related to the last point there may be a need to track changes. For instance if the object updates through a web service call, and the request is generated based on flags set by the client. (for example imagine that in addition to calling setFoo you also had to say setChanges(FOO) or something along those lines) You may want to be able to handle cases that use flags and those that don't (this is also possible within the same framework) 4) you will most likely want to be able to apply variable permissions to the different fields in a given object so that they appear read/write-able only for users with sufficient access 5) you will definitely want a way to order the processing of the different fields of the object, for instance you may want the object's last getter to be called first (as opposed to just walking through every one of the object's get methods sequentially) 6) you will also definitely want to be able to display the fields in the UI in an arbitrary order 7) you will most likely want labels for the fields which differ from their actual method names These are just some of the things you'll want to capture in your metadata. Putting all these things together will let you generate UI automatically, and with a little more work (using an ORM) you can also have your business object build the queries itself. Of course all of this is complicated and requires either writing your own stuff from scratch, or finding a suitable package. Let me know if you have any questions, or would like to explore an issue further. Quote Link to comment Share on other sites More sharing options...
sifix Posted July 15, 2007 Author Share Posted July 15, 2007 Thanks a lot for your suggestion I will take a look and try to learn things before I begin.. thnx ++ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.