eZ Community » Forums » Developer » how to save data to database in ez...
expandshrink

how to save data to database in ez publish

how to save data to database in ez publish

Monday 20 October 2014 9:16:23 am - 1 reply

Hi,

I want to click on a button called favorites and per click i want to save that as a separate data.

How can we save data to a data base in ez publish.(Is there any examples?)

Finally what i want to achieve is  if user click on a favorite button i want to save that as a favorite.

Please help.

Friday 24 October 2014 10:10:57 am

Hi upaksha,

which version of eZ Publish are you running?

Depending on the version you would add a route or module-view to receive the request sent upon clicking the button.
This controller-action or view will then store the data using doctrine or ezpersistentobject.

Storing the data: 

In 4.x the preferable method of saving information to the database would be to extend the eZPersistentObject.
Examples can be looked up in the kernel itself. (e.g. eZContentObject is extending this class).

When using the symfony-stack of eZ Publish I personally prefer to use doctrine to store data to the database.
Depending on the exact version you might need to add "doctrine/orm" to you composer.json.
When using doctrine I'd suggest to lookup the doctrine-section in documentation of symfony.

Tell me if that helped or you need more information on the topic.

Modified on Friday 24 October 2014 10:11:13 am by Steve Konrad

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from