I'm trying to use MongoDB with Symfony2.1 but I'm facing a problem.
I'm following the tutorial from Symfony website called "How to implement a simple Registration Form with MongoDB".
In this tutorial, it is said that we can add a constraint on email field as a unique field.
After some tests, it doesn't work. I can add more than once the same email for my User entity.
The annotation #MongoDBUnique(fields="email") seems to fail.
I found someone which has the same problem in a Google Group. At this time (posted on january, 6th), no one has answered or no one seems to have any answer unfortunelately.
Thanks for any clue !
Make sure that index really exists in MongoDb. The specified annotation doesn't create any index automatically.
For more information check this.
Related
Does anyone have a working example of a hook to update a document with a timestamp on update?
I was able to set the timestamp on record creation by using DEFAULT sysdate().
This doesn't help me when updating an existing record. Any advice would be appreciated.
Ok. Check out this thread in GG. I posted a Javascript function, which does what you are asking for.
All you need to do is save what I came up with as a custom function then create the customer trigger property on your class. See this section of the docs on how to do that.
Scott
I'm sure the first answer is great but here's another option I wrote for myself. It takes a schemaless prop from your updating record to save the editing user, and could be extended to save the field being updated too.
I have decided to rewrite an application that I wrote a long time ago in ZF1. A key part of this is the utilisation of a FrontController plugin that looks at a URL and if no matching route is found it will pass it on to another controller to process.
The benefit of this is it worked for all modules without having to make further changes as it was registered as a plugin for the frontcontroller.
Can someone please help as to how I could achieve the same in ZF2
Thanks in Adavance
Adam
Now you can do it in Events.
ZF2 have default events and you can attach your code(listeners) to particular event. List of all ZF2 default events.
You have to play around with ZF2 events/listeners to see what will be the best choice for you.
I am doing similar staff in MvcEvent::EVENT_ROUTE. Check current route, check current user permission and if user don't have permission just return different response.
There you can found great article about how to create event/listener
"Understanding the Zend Framework 2 event manager".
I use Symfony 2. I have so far 2 bundles. The first bundle is a called UserBundle and is build using FosUserBundle. The second bundle is called GeoBundle and contains one entity called France which's table contain almost 40.000 records. Each record refers to a city with postal code, regional code.... Basically I use this entity in my user registration form so that the user can select an appropriate city from the list. By the way I use an Entity Field Type to do that.
My problem is that everything is working fine with just a few records in the table but with the almost 40.000 records the page where my form is, is not even opening. I already extended my memory in php.ini to 256M and more but the page is still not opening.
So my question is simple. What would be the best solution to populate a select field with that many records? I am of course open to other solutions. Thank you in advance. Cheers. Marc
You're probably best using an autocomplete field. You can find plenty of solutions on Google. Or try a bundle like https://github.com/shtumi/ShtumiUsefulBundle
Simply don't load the full list, that would be bad for your server, your bandwidth and for the memory required by the client (if it's a mobile browser, forget it!)
I suggest to use jQuery UI Autocomplete, this is a jQuery plug-in that can load the elements required via Ajax from your server, so you don't have to load the hole thing. It's also well tested and easy to implement.
http://jqueryui.com/autocomplete/#remote-jsonp
Try using this Symfony2 bundle.
https://github.com/genemu/GenemuFormBundle/blob/master/Resources/doc/jquery/autocomplete/text.md
This is very helful and in Symfony2. It will save your time and have a look at its other extensions
I've been developing simple PHP/MySQL web sites for some years.
Never used a PHP Framework before and I understand I'll need to know OOP, no problem.
I'm about to start a SaaS project of my own.
A)
So far, I've seen Yii generates the CRUD and pages according to the DB.
Is it easy to modify the generated code?, like, adding a new DB field and its form field without not generating again all the stuff every time I change something in the DB and losing other customizations?
I mean, I'm 100% sure the generated DB code and pages are not going to be enough and I'll be constantly adding and correcting fields, and adding more tables etc.
B )
My project will include a Shopping Cart and Calendar(for events, tasks, etc.).
Does Yii has these options or at least an easy way to implement it like the Authentication options or Database listing, etc.?
C) Does documentation has this explained as a tutorial/book or is more like a reference(minimum explanation that only advanced user understand how to integrate it)?
thank you very much
Yiiframework has excelent documentation (you can start from here). Also there is an extensions area in the downloads section where you can find all available yii extensions.
All your questions can be answered if you follow their easy tutorial.
A) Yes, it's easy. You will just add code for new fields not changing it all.
B and C are answered by Stratosgear very well.
Is it easy to modify the generated code?
Yes it is. If you later decide to add more fields to the table, you can do that from your Phpmyadmin using sql commands.
You also need to edit the generated class file adding those new fields to correspond with that on your table.
I have created a signup form for secure zone in Business Catalyst. I want to give user access to that form in order to update the fields. I have created the page and its working only problem is there is no way to pre-populate custom fields in the form. I talked to their support and research a lot but all in vain. This is very basic thing BC missing. Is there a hack for it or some alternatives?
Just adding for anyone finding this that you can also populate fields that have been created and extended in the crm if they're stored against the customer record.
{module_customerfield,crmextformID,FieldID}
eg
{module_customerfield,7470,82256}
More info in the forums.
Good News Now Business Catalyst supports this feature for more information read:
Allowing Customers to view and update CRM details
I have had this same issue and hopefully there will be someway they can fix this in the future. What I did for the time being is I used other tags that I was not using. IE module_workcity was not and won't be used by me so I then put that in a field that I needed the custom tag for. Here is a screen shot of what I am referring to. - http://screencast.com/t/b3pvuOcTi one thing to note here the screen name is different than username for this site.
Note: When the user signs up I have the person filling out a field for the "workcity" and just change the labeling.
Not sure if this is an option for you, and it can take some work but might help.
Hope this helps. - Another note BC related question you will get quicker answers on the forums there - http://businesscatalyst.com/support/forums