Integrate custom annotations in Zend Framework and Doctrine project - zend-framework

I need some advices or experiences in integrating custom annotations for Doctrine generated entities, but I also want to keep native Doctrine annotations so that they can be somehow registered together.
I have succesfully integrated Doctrine in my ZF application and tested it.
Now I want to have some validations inside my entites. I don't want to write any code in my entities or modify setters. I googled for suggestions and there are some libraries that do the job. Those libraries also provide the ability to return Doctrine entities objects as array (toArray()).
I tried to integrate one of those called Spiffy Library (https://github.com/SpiffyJr/Spiffy). Homepage http://www.spiffyjr.me/.
I followed instructions on that page to include it in my project but no luck. Any help on these would be so appreciated.
Guess I didn't setup correctly AnnotationReader. However I did AnnotationRegistry-ed some of files from Spiffy library (spiffy\Doctrine\Annotations\Validators).
Also gave Spiffy Abstract library my entity manager from ZF registry.
I can also paste some of my code here if neccessary.
Thnaks in advance.

Related

Symfony 2 base services configuration

We are starting to use Symfony 2 in our system, not as a whole but by pulling the components we need and kinda build our framework upon it. We have learned that from these articles
http://fabien.potencier.org/article/50/create-your-own-framework-on-top-of-the-symfony2-components-part-1
And from learning how Silex works as well.
I'm trying to find out how Symfony framework/standard package defines all the kernel.* services but I cannot seem to find that anywhere even after searching all files. Please give me a point if you know.
Symfony2 framework loads bundles from app/AppKernel.php and defines global services in vendor/symfony/src/Bundle/FrameworkBundle/Resources/config/*.xml

Zend Framework and fuelphp

I wanted to know if it was possible to use zend framework libraries from zend 1.11 in fuelphp? fuel looks nice and I started looking at it as I believe its the next logical step for any CI developer.
Is there any site or a howto for using zend library with fuel?
Thanks
It really depends on what portions of Zend Framework you want to use. Some parts, e.g. Zend_View are tied into the MVC-part of the framework, but components like Zend_Pdf or Zend_Service_* have only few dependencies and should work fine in other frameworks as well.
What you should do is check out the Reference Manual to see what other components are required by the component you are trying to use. And then put them in a library folder. Alternatively, just put the whole Zend Framework in a folder if you don't mind carrying the dead weight with you.
I've been using ZF-components standalone and found that it's useful to add it to include_path as you would when using ZF as MVC-framework, because some ZF-classes are instantiated dynamically, i.e. not via require_once and that won't work without the folder containing Zend/ being in the include_path.
Finally you have to add the folder to your autoloader, this should be as easy as:
Autoloader::add_namespace('Zend', __DIR__.'/path/to/Zend/library');

Tutorial on setting up GWT-Validation Framework for a simple app?

I'm looking to setup the GWT-Validation Framework (client side for now) in our application, but I'm not clear from the docs what pieces I need and what goes where?
We are using GWT 2.1 and MVP. I have the inherits entry for Validation in the gwt.xml, but what goes actually goes into the View, Activity, etc... I'm not aware of any tutorials available.
Any help would be appreciated!
Aftermath:
At the time when I was trying to use it, GWT 2.1 wasn't compatible with the GWT-Validation framework. After doing more reading I found this out. I don't know if that is still the case.
I assume you are referring to the validation framework in GWT and not the gwt-validation library? If that's the case, here is a page that describes how you can do bean validation: http://code.google.com/p/google-web-toolkit/wiki/BeanValidation. If you are actually referring to the gwt-validation library, here is a page that describes how to use it:
http://code.google.com/p/gwt-validation/wiki/ConceptOfOperations
Here is a link that gives some information about the GWT Validation Framework, GWT-Validator and the authors solution, the GWT-Validation library. It is a good synopsis of the issues and why he wrote the new library with some code snippets.
The GWT Validation Library.

Useful Silverlight class library with reference to .NET class library

I'd like to develope simple set of controls to display many sort of data and be useful in normal silverlight application and can be used in ASP.NET MVC2 application. Right now i have no idea how to link those tehnologies, but this isn't my concern right now - i just heard it is possible and i'll find out how to do that...
Right now i'd like to know how can i use my Model's classes in such SIlverlight class library. I've generated POCO classes in EF4.0 for ASP.NET MVC2 application. Everything works great, but now i'd like to use some of those classes - create silverlight's controls, some ViewModel classes and fill my controls with data passed from my Model, used in ASP.MVC's app, through ViewModel.
Everything should be tested in any simple silverlight's app and at the end i'd like to be able use this class library in silverlight app and in ASP.MVC 2 website...
Silverlight it's own runtime and in general you cannot mix normal .NET assemblies and Silverlight assemblies.
However, one option is to share the source code by linking the same source file to two projects that compile to the different runtimes.
Another option is to use WCF RIA Services where Visual Studio will code generate your model classes in the Silverlight project and there are also options for sharing code between tiers. You will also get a service to operate on the objects from Silverlight. The service can be built on top of EF4.0 with very little code.
Finally, Silverlight 4 and .NET 4 are in some cases able to share assemblies if certain criteria are met. See Stack Overflow question named Silverlight 4 Assembly Sharing Problem.
What you need to do is use shared code.
you do this by adding an existing file to a project. In the add file dialog there is a arrow on the button that exposes the add as link option.
the point of this is that you cna have 2 projects which target the different CLR's but contain the same code and namespace references ... you can leverage these to have code that works on both versions of the CLR very simply.
Its really quite powerful. I have one set of tests that can target both versions.
Of course you are limited to the set of common functionality but that is implicitly part of your requirements anyway.
You cna even pass the objects over a service and have them deserialise nicley into the other CLR. Kinda suprising how well you can use the symetry
I am currently using this for aproject and am achieving what you want and after a few hours of playing with really suprisingly painless.
regards

How to prune Zend Framework?

I wouldn't use most of the classes from Zend Framework, that's why I'm looking for the thinnest possible ZF configuration.
Is there a better way of finding what I really need other than deleting the whole library/Zend folder, then putting back files based on the error messages that I receive?
I have not used it myself, but http://blog.fedecarg.com/2009/02/01/zend-framework-automatic-dependency-tracking/ may be what you are looking for.
Hm...
There is a lot of information about Zend Framework on SO and with a little bit of reading you would have found the answers to your question
You would also find the answers to your question by just reading the introduction to Zend Framework on the Zend Framework website.
No, that's not how you'll do it. Zend Framework, unlike most/all other PHP frameworks, is rigidly loosely coupled. You can use every component stand-alone. You can only use the loader, or only Zend_Translate. Or you can just use the MVC modules, or Zend_Db, etc.
Of course if you use Zend_Form and want to validate or filter the input, you'll need Zend_Validate and Zend_Filter. But you'll know that because you'll instantiate objects. So just copy into your empty library folder the modules you need. Or even better, copy everything in! A) you won't regret it. B) disk space is not your problem.
What I would do is set up the plugin loader cache and then purge all files apart from the ones called within the automatically generated include file.
zend.loader.pluginloader.performance
I hope it makes sense... :o)