Help with creating a complex app using the advanced template

Hi guys,

This is essentially a follow-on from this thread: -

http://www.yiiframework.com/forum/index.php/topic/67341-basic-app-or-advanced/page__pid__288618

I am creating a new app, using the advanced template and I will have a few questions to ask as I develop it. Aside from this thread just being of use to myself, I am hoping it will develop into something of a blow-by-blow account of developing a complex, secure and resourceful application. The Yii guides are fantastic and I have already created several web apps in Yii but none as complex as this. I am also aware that I have also not been very strict with version control, documentation etc.

So, as I look to begin the application, can I ask how experienced developers plan, document (aside from PHPDoc) and version control their PHP projects?

Version control — git. Plan — on paper. Document — in text files using markdown.

Thank you.

What actually happened was I ended up drawing up better documentation for the company, which I am still in the process of doing. I think myself and my business partner went off too quickly, we realised this and reevaluated and now so I went back with a more technical, organised approach. I am currently finishing off the documentation regarding the business model and each specific business process and I will use both these documents to map out the database properly before I commence with anything else.

BTW regarding PHPDoc… what is the best way to extract documentation regarding the classes? I have done this before with PHPStorm but it was a long time ago I have frankly forgotten…

Extract documentation from where?

Again, thanks for the reply.

Sorry if I am not giving great information here but in regards to professional project management I am something of a novice.

I remember there being a way where you could run something on PHPStorm and it would great a dump of the class structure, variables etc of the application. It was a long time ago I did it and it was under the instruction of someone else.

Sorry I cant be any more help.

BTW do you have any rules for how often you commit to version control?

We’re trying to commit at least once a day.

So there are no specific milestones etc in your commits? Just try to keep it regular? Can only be a good thing, I would imagine.

In Yii — nope. In stay.com — yes. There are milestones. Max two weeks in time span. But these are handled in branches which are getting commits every day.

Do you have a specific security framework for reference in terms of use profiling, IP bans etc? I am totally new to all thise but I am reading the AppSensor document just now.

Nope.

My project is in full swing now. First time I have tried to really do a large, professional project. It’s quite exciting actually.

I will try to keep any questions to a minimum, but can I ask what field type you use for things like gender, marital status etc? Specifically do you use an integer with a foreign key to a reference table for it or ENUM? I’ve always preferred integer+FK as opposed to ENUMs but that’s just me and possibly because I never used ENUMs while I was learning.

Sorry if it seems a silly question but I am trying to get everything done properly :)

For gender I’m using nullable bit field since there are only 3 possible variants. For marital status — external table + int FK.

Thanks. I’ve actually decided to use a foreign key for all those types of fields as it seems now I it will be a multi-lingual application (two main languages) and I will need to produce reference lists in the user’s language. So each ref table will have the two languages and the dropdowns will display the language based on the user’s current language.

Thanks again!

Hoping I am not just asking mindless questions here, just want to make sure I am getting this entirely correct to save later reworks.

If I have a table that is a reference list for countries that contains the the English name and the German name and has the following fields: -

id

country_en

country_de

I have to put a unique index on the country_en and country_de fields but do I need to put a unique composite index of those two columns? It would seem unnecessary?

Not a good idea if you plan adding more languages.

You mean having the fields hard-coded for the two languages? I was thinking that but as of now it seems it will be likely that it will be only those two languages for a while.

Off the top of my head, I think this would be a good solution: -




country

    id

    country_name <--- then name in English (for visual reference)


country_language

    id

    country_fk (country.id)

    language_fk (language.id)

    country_name <--- the name of the country in the language specified in the country_language.language_fk field


language

    id

    language_name



Then when I query the DB to populate the dropdown, I’ll select country.id, country_language.country_name WHERE country_language.language_fk = the current user’s language id.

Does that seem correct?

language table isn’t needed. There is https://www.ietf.org/rfc/rfc5646.txt so you know all the language codes possible.

Thanks again.

Are you suggesting the language field in country_language should be a simple text field or ENUM instead?

Currently there are employee and candidate tables/models. There will possibly be a customer model added later on. Given that all three of there model will share common attributes (first name, second name, date of birth) etc, would the best approach to be to atomise these models so there is a common person table/model which contains these common fields or would this be taking it too far? I would imagine it will also impact on performance with the increase in related tables.

I get the impression that there is little point in the type/level of atomisation I suggested above.

I am also thinking about how to approach holding the address information for candidates and employees. It is my intention to not simply have a single entry for the address but to be able to log historical information about address.

With this in mind, is this an appropriate model for storing addresses?

https://api.genmymodel.com/projects/_7FQ7cJUAEeWPetZvgdr7ng/diagrams/_7FQ7cpUAEeWPetZvgdr7ng/jpeg

I would also have an employee_address_history table in there to take care of the relational data for the employee model. I would also need to add in a validator into the control to ensure that the address_history.from address_history.to fields fit certain criteria (no over lapping date ranges etc).

I do hope I am not overwhelming with questions here. I am actually quite confident in all aspects of application development but I really want to make sure I am getting the underlying table structure correct before I create the database and the models. I just need to get a 2nd opinion on a few things before I really get started into the rest of the application.

Thanks again!