I've started a CI project and I'm going to use it with Doctrine, there is benchmarking system for the latter and I'd like to remove the ability to use native CodeIgniter DB class, since it won't be benchmarked. I though about simply removing the corresponding files, but I'm afraid it could cause CI errors in other places. How can I remove the ability to use native CI DB class?
I personally would not do it. I just want to force the future developers with random level of qualification not to load it as well
I also use Doctrine in connection with CodeIgniter and there is no need to do anything with the CI DB class. Just ignore it and use Doctrine as you would do normally. If you don't use the DB classes or don't load it, they won't get benchmarked.
If you haven't already found it, look at the wiki, ot gives a good idea what to do with Doctrine
edit to your 1st comment: If you really want to disable the DB class, I see one way: either delete the core file(s)/folder(s) or rename it so that a loading just fails. Alternatively, change their code so they cannot be loaded. If you do so, it should be really well documented somewhere so that the error will be obvious to someone after you.
Don't load it in your controller.
Theoretically, you could create a hook and disable CI's DB functionality. In the hook, you would extend the CI_DB class and the display an error message if the class gets loaded. I'm sorry I can't give specifics, but you'd probably have to inspect the system's database classes to see what would need to be altered.
At least that way, you wouldn't need to make changes to the CI core.
Related
I'm looking at frameworks and CMSs for a project we are starting, a website that needs to support localised content.
Laravel looks good and certainly allows you to localise UI content, but it doesn't seem to natively support the localisation of content stored in a database. This seems surprising, I'm wondering if I'm overlooking something? (CakePHP, for example, has a TranslateBehavior for this purpose).
Edit To be clear, I'm asking if there's anything baked into Laravel to handle this, I'm aware I could code equivalent functionality but think that that would be a fair amount of extra work.
Modifying your data as it enters or leaves the database is fairly easy.
If you store the translation key in the database, you can translate when you pull the data out. Use getter and setter methods in the model. You may also want to look at Model Events.
I'm learning MVC3. There is something I'm trying from many hours and now I think I'm totally lost.
I created a database first, then generated Models from it. Now I wanna know if it is possible to use scaffolding to generate a model with CRUD views? I tried several things. Firstly the error- Unable to get metadata.
Googling it first misled me that there is something wrong with EF4.x. Reinstalled it and wasted time. Then I tried Automatic Code Generation feature but its giving ambiguity errors between previously generated classes.
Is it even possible to do what I'm trying? How? Or do I have to code for the views?
Go to your controller method, right click and add your view, You will need to check strongly typed-view then select the model and the scaffold template.
If you still get an error, make sure you decorate the primary key with the attribute [key], also make sure all properties have the same name as your DB field or you will get an error.
I am trying to implement a OrientDB HTTP connection in Code Igniter, but I can't quite decide how to go about it. Basically, I am using the php code found here, and I cannot decide whether to make that file collection into a library or a helper.
Right now, I am leaning towards a helper, because $this->load->library() automatically instantiates the class, where I will need the ability to call static methods as well (as can be seen in the use of BindingParameters::create('http://admin:admin#127.0.0.1:2480/demo');) in the example code.
So, if I make these files into helpers, which should not instantiate the classes, is there a way to load them without adding a "_helper" suffix to the files themselves? I would like to avoid using require/include, but if there is no other way to accomplish this then I have no choice.
Does anyone have any tips or ideas that may help me with this? Thanks beforehand.
We are planning a rewrite and I want to get the latest tools to make sure we are doing things the best way. I like how code first keeps the DB structure in code.. which is already source controlled.. So I am hoping that would remove the need for a DB project.. Yes? No ?
DB projects also allow you to sync data between enviorments but that is something else that has nothing to do with code first
Using Entity Framework Code First you can write things out in C# code and have it create/persist the data. Since you can source control C# code, you can source control the database, but only the schema. You won't be able to 'source control' the data.
Personally, I don't use it because it forces you to do some wonky stuff such as declaring properties as virtual and using decorators all over the place. Not only that but you really on the framework to do a lot of things behind the scenes and when things go wrong that's never good.
The route I choose and that works very well for me is to declare a Project.Domain class library project with the Entity Framework generated model from an existing database.
Then I would reference this project from my Project.WebUI (my MVC3 project) and have access only to public repository classes.
So my project looks like:
I'd like to know if there is a way to find defunct action methods on controllers. I have R# and ran analysis, but it didn't seem to check if the asp code called an action. Is there anything that does?
Implement a global action filter that records the action name in a persistent store somewhere. This way you can track which actions do get executed and figure out what's missing from possible actions. It's a bit tedious but may work for your purposes.
No, a tool what not know what actions are required, as they are invoked by the routing configuration. I suppose you could write a tool which could check which actions are accessible given the current routing configuration, but then it wouldn't be able to know if those methods wouldn't potentially be used by other code, as they are marked as public.