[2751 total ]
The Law of Demeter
SfGuardUser sync with Google Apps
Prepare yourself for BugHuntDay

With the symfony BugHuntDay just around the corner next saturday 14th of november, it is time to have a look at what you can do to prepare yourself. Luckily, one of the PHPBenelux crew members, Thijs Feryn, has posted a tutorial on his weblog on what ... [More] you can do to prepare for the BugHuntDay.

If you want to join us in Herentals, and you have not yet registered for the event, please do so now! This will help us know how many people to expect, which is especially important since the event sponsor Intracto Group will be offering free food and drinks!

If you can not make it to Herentals, don't feel bad! You can still join in on the fun. You won't need to register, but you can simply join us in the #symfony irc channel on irc.freenode.net. Throughout the day, symfony core team members will be there to help people with joining the BugHuntDay from afar. If you want to meet some of the core team members or be eligible for food and drinks, you'll have to join us in Herentals though.

We hope to see you all this saturday!

Be trained by symfony experts
- Dec 16 Paris - Jan 20 Paris - Feb 24 Paris - Mar 24 Paris [Less]

symfony 1.3 beta 2

The core team is happy to announce the immediate availability of symfony 1.3.0
beta 2. It is available for installation over PEAR or by checkout directly
from the Subversion repository. Visit the installation
page for all the ... [More] details.

This is the final beta release of the 1.3 branch, so there aren't too many
exciting new features to announce. Our focus has been on improving the
stability of the existing code base since the API was locked with the beta 1
release. More information about what's new in symfony 1.3 can be found in the
what's new and
upgrade tutorials.

Propel 1.4 stable

Integration with Propel 1.4, whose first stable version was just
released, has been
cleaned up and is now more stable and easier to customize. As Fabian
mentioned
earlier,
the new Propel 1.4 detailed query logging mechanism is now easily configured
using symfony's database configuration file.

Response Validation

The response tester, which received a new method for testing the validity of a
response in the 1.3 beta 1 release, now supports XSD- and RelaxNG-based
validation as well as DTD. What's more, standard DTD definitions are now
bundled with symfony, eliminating the cost of external requests when running
these validations.

Minor bugs were fixed in the newly-enhanced pager objects, the Propel upgrade
task, and the generation of form classes based on Doctrine inheritance models.

What's Next?

We plan to have two release candidate releases before releasing the first
stable version of symfony 1.3 at the end of the month. The schedule, subject
to change, is as follows:

16 November: 1.3.0 RC1
23 November: 1.3.0 RC2
30 November: 1.3.0 stable

Yep, that's one release a week for the rest of the month. If you haven't done
so already, please take a moment to test upgrading an existing symfony 1.2
application to 1.3. The upgrade should go smoothly at this point, but please
post any issues you may encounter to Trac. Thank you for helping make this
coming release the best it can be!

Be trained by symfony experts
- Dec 16 Paris - Jan 20 Paris - Feb 24 Paris - Mar 24 Paris [Less]

propel 1.4 stable release
Lime 2 alpha released

I am happy to announce the immediate availability of Lime 2 alpha 1! The second
version of symfony's very own testing framework has been under heavy development
since early July. Many exciting new features have been added since then, and ... [More] now
you have the opportunity to try them out!

In this blog post, I want to outline the most important new features of Lime 2.

Upgrading a Project

Upgrading a symfony project to use Lime 2 is straight forward. You simply need
to replace the file lime.php that comes bundled with symfony with a symbolic
link to the lime.php that comes bundled with Lime 2.

Lime 2 is nearly completely backwards compatible! The only thing that is not
BC is the configuration of the harness and the coverage class. In Lime 1, this
was done through public properties which have now been removed. Instead, you
can pass these properties as options to the constructor.

First of all, checkout a copy of Lime 2 from SVN:

> svn co http://svn.symfony-project.com/tools/lime/tags/RELEASE_2_0_0_ALPHA1 lib/vendor/Lime2

Now you can replace symfony's lime.php. The following commands assume that
symfony is installed in lib/vendor/symfony. Fix the paths if your project
directory structure differs.

> cd lib/vendor/symfony/lib/vendor/lime
> mv lime.php lime.php.1.0
> ln -s ../../../../Lime2/lib/lime.php lime.php

Your done! All your tests will now use Lime 2.

Annotation Support

Often it is necessary to execute some code before every test to prepare the test
bed. This code, also called the fixture setup, had to be written manually
before every single test in Lime 1. To avoid this code duplication, Lime 2
features annotations to structure and control your test code.

<?php
 
require_once dirname(__FILE__).'/../boostrap/unit.php';
LimeAnnotationSupport::enable();
$t = new LimeTest(1);
 
// @Before
 
copy('data/fixtures/test.png', 'web/uploads/test.png');
$thumbnail = new CukeetThumbnail('web/uploads/test.png');
 
// @After
 
unlink('web/uploads/test.png');
unset($thumbnail);
 
// @Test: resize() resizes the thumbnail
 
$thumbnail->resize(100, 100);
$size = getimagesize($thumbnail->getPath());
$t->is($size, array(100, 100), 'The image has been resized');
 
// @Test: save() saves the thumbnail under a different name
 
$thumbnail->save();
...

The most important annotation is @Test. This annotation marks a piece of test
code and optionally takes a comment that is printed on the console. The other
annotations are @Before, @After, @BeforeAll and @AfterAll. The first
two can be used to mark code that is executed before or after every test.
The other two are used to mark code to be run once before or after all tests.
All code following an annotation belongs to this annotation until the next one
is opened.

Parallel Processing

Lime 2 includes the possibility to execute multiple tests simultaneously, taking
advantage of modern multi-core processors. This way, the performance of test
suite runs can be dramatically improved.

This functionality is not available from the symfony tasks yet. Instead, you
need to manually setup a test suite. To do so, add the following code to a
script called prove.php in the directory test/bin:

<?php
 
include dirname(__FILE__).'/../bootstrap/unit.php';
 
$h = new LimeTestSuite();
$h->register(sfFinder::type('file')->name('*Test.php')->in(dirname(__FILE__).'/..'));
 
exit($h->run() ? 0 : 1);

Execute the test suite from a console window:

> php test/bin/prove.php

All your tests should execute as usual. Now add the switch --processes to
enable parallel processing:

> php test/bin/prove.php --processes=16

The performance of the test suite should be better now. We'd be happy if you
shared your personal performance gain in the comments!

Powerful Mock And Stub Generation

Lime 2 features one of the most powerful yet easy to use mock and stub generators
available in PHP. Usually you want to test your classes without testing any
other classes that they depend on. This is why these other classes are usually
replaced by fake implementations in tests, also called Mock and Stub objects.
Because coding these fake implementations takes a lot of time, Lime 2 generates
fake implementations for you.

To create a Stub or Mock object call stub() or mock() on your LimeTest
object:

$user = $t->stub('sfUser');

The basic difference between Stubs and Mocks is that Stubs ignore any unexpected
method calls by default while Mocks throw exceptions in this case.

To configure a method call, just call the method with the expected parameters.
If you don't care about the parameters, pass the method name to any():

$user->setAttribute('foo');
$user->any('getAttribute');

You can configure method return values, exceptions and forward method calls to
callables:

$user->getAttribute('foo')->returns('bar');
$user->getAttribute('moo')->throws('Exception');
 
function testGetAttribute($attribute) { ... }
$user->any('getAttribute')->callback('testGetAttribute');

After configuring the expected method calls, you have to call replay(). Only
now your object will behave as configured. Optionally you can call verify()
after executing the test to check whether all configured methods have been
called.

$user = $t->mock('sfUser');
$user->getAttribute('username')->returns('bernhard');
$user->setAttribute('authorized', true);
$user->replay();
 
$form = new LoginForm($user);
// internally calls getAttribute() and setAttribute()
$form->save();
 
$user->verify();

When you want to test exactly how often a method was called, use either of the
count constraints:

$user->getAttribute('foo')->never();
$user->getAttribute('foo')->once();
$user->getAttribute('foo')->atLeastOnce();
$user->getAttribute('foo')->times(3);
$user->getAttribute('foo')->between(2, 5);

If you want to test single method parameters, use parameter() with any of
the test operators (like is(), like() etc.) available in LimeTest:

$mailer = $t->mock('sfMailer');
$mailer->any('compose')
->parameter(2)->is('bernhard.schussek@symfony-project.com')
->parameter(4)->like('/Your activation code is ABCXYZ/')
->returns($message = $t->stub('Swift_Message'));
$mailer->send($message);

More information about the Mock and Stub generator will be available in the
upcoming documentation.

Test Operator Overloading

If you ever tried comparing two Doctrine objects with is(), you have
probably seen that the tests almost always fail.

$user = new User();
$user->fromArray(array('username' => 'bernhard'));
$user->save();
 
$result = Doctrine::getTable('User')->findOneByUsername('bernhard');
 
$t->is($result, $user, 'The correct user was returned');

The problem is (from a testing point of view) that Doctrine stores a lot of
metadata in the records that differ from record to record, even if both
contain the same properties, primary key and relations.

Lime 2 features support for overloading the test operators for specific data
types. You can implement your own "tester" class that specifies when the operator
should match for a value of this type.

class myTesterDoctrineRecord extends LimeTesterObject
{
/**
* Matches when two Doctrine records have the same primary key,
* attributes and relations.
*/
public function is(LimeTester $otherValue) { ... }
}
 
LimeTester::register('Doctrine_Record', 'myTesterDoctrineRecord');
 
$t->is($result, $user, 'The correct user was returned');

The supported datatypes are null, integer, boolean, string, double,
array, object, resource and any class or interface name of your choice.

What's Next?

Many more features were added to Lime 2. These will be explained in further blog
posts and the upcoming documentation. In the next weeks, a CLI tool for
executing Lime tests in a developer friendly way will be implemented, which is
the last major planned feature before entering beta stage.

Lime 2 is expected to enter beta stage in December or January 2010, depending on
the amount of developer feedback on the alpha releases. You are warmly invited to
check out the source of Lime 2, play around with it and give feedback on the
symfony-users mailing list or in
the symfony Trac. Just keep in mind
that the code is still alpha, so please don't use it in production.

Be trained by symfony experts
- Dec 16 Paris - Jan 20 Paris - Feb 24 Paris - Mar 24 Paris [Less]

Review of the new Symfony book
Symfony versus The Law Of Demeter: does Symfony promote bad habits?
A week of symfony #149 (2->8 November 2009)

Symfony documentation was heavily updated this week, mostly the new Jobeet 1.3 book. Meanwhile, symfony 1.3 continued polishing some features before its long-awaited final release. ORM development activity was frenetic and both Propel and Doctrine ... [More] were updated to their latest versions.

Development mailing list

Discussions about deprecated Errors on PHP 5.3, module extensions and generator files

Development highlights

r23502: [1.3] made test working under windows as well (ignores line breaks)
r23511: [1.3] fixed project:optimize help
r23515: [1.3] fixed Form Helper use of Rich Text Editors broken by changes in autoloader

r23520: [1.3] references to external modules in bundled xhtml11 dtd
r23521: [1.3] added unit tests for sfDebug and sfTimer[Manager]
r23526: [1.3] updated propel upgrade to be smarter and include consideration for nested set builders
r23543: [1.0] fixed deprecated use of split for PHP 5.3
r23544: [1.3] moved getMailer() method from sfAction to sfComponent

r23545: [1.3] refactor the project:send-emails task to give a getMailer() method for all tasks
r23549: [1.3] refactored the app:routes task to give a getRouting() method for all tasks
r23567: [lime 2.0] fixed generating a mock class does not trigger autoloading to allow existing classes to be stubbed
r23568: [1.3] added some more useful output to response tester's isValid method
r23569: [lime 2.0] added a return value can be configured even if a callback is specified for a mocked method

r23600: [1.3] added real cache key (including prefix) to the partial info panel to aid checking the cache
r23651: [1.3] made sfTask::getRouting() lazy
r23675: [lime 2.0] added method ->parameter() to the mock for setting constraints on single method parameters
r23677, r23678: [lime 2.0] pushed deprecated methods LimeTest::compare(), LimeTest::compare(), LimeTest::hasMethod() and LimeTest::isa() down to class lime_test

r23679: [lime 2.0] mocks always use parameter matchers to compare method parameters now. As a result the error messages when a method is called with wrong parameters are now more clear
r23680: [lime 2.0] implemented method LimeTester::unregister()
r23682: [lime 2.0] exception objects can now be passed to LimeTest::expect(). They are compared using the new constraint classes which allows for a more flexible usage of expect() with custom exceptions
r23685: [lime 2.0] renamed the assert*() methods to match the more simple method names in LimeTest and LimeMockInvocationMatcherParameter
sfDoctrinePlugin:

r23516: [1.3] added a test to check if the BaseForm class exists when building Doctrine or Propel forms
r23518: [1.3] fixed cascade schema.yml across multiple plugins generates Plugin classes to wrong directory
r23539: [1.3] fix to Doctrine model building to allow packages
r23601: [1.2] updated Doctrine to 1.0.13
r23668: [1.3] fixed doctrine form inheritance when the foreign key on one inheritance model references another inheritance model

r23690: [1.3] improved timings in doctrine logging

sfPropelPlugin:

r23516: [1.3] added a test to check if the BaseForm class exists when building Doctrine or Propel forms
r23692: [1.3] now using propel 1.4.0 stable tag

r23696: [1.3] updated Propel sfWebDebugPanel to respect configuration done in DebugPDO
r23697: [1.3] made Propel sfWebDebugPanel creation less magic and more explicit

...and many other changes

Symfony components

dependency injection:

r23506: added support for service references in parameters

yaml:

r23504: fixed a notice on non-defined constant

Development digest: 199 changesets, 35 bugs reported, 22 bugs fixed, 4 enhancements suggested, 2 enhancements closed, 8 documentation defects reported, 17 documentation defects fixed, and 16 documentation edits.

Documentation

Updated Italian translation of Jobeet tutorial
Updated 1 day 1 ticket, and How to contribute to symfony pages

Updated symfony 1.3 reference:

chapter 6: added two missing options in the reference book for the admin generator, fixed date_Format info
chapter 14: added documentation for the module.yml configuration file

Updated Italian, and French translations of symfony 1.3 reference

Updated Jobeet 1.3 / Practical symfony 1.3 book:

chapter 1: updated chapter 1 of Jobeet

chapter 3: fixed Doctrine specific shortcut, changed all doctrine:build* task to use the new doctrine:build task
chapter 4: added the short version of include_slot() for default values
chapter 5: replaced redirect() calls with the new support for objects
chapter 7: use the new Iterator interface of Pager
chapter 9: added a paragraph about --only-failed option of test:all, added a tip about the new --xml option of test:all

chapter 10: added usage of useFields() in Jobeet chapter 10, added a tip about how to not generate form and filter classes, replaced redirect() calls with the new support for objects
chapter 11: replaced redirect() calls with the new support for objects
chapter 13: replaced redirect() calls with the new support for objects, changed all doctrine:build* task to use the new doctrine:build task
chapter 15: replaced usage of contains() by matches()
chapter 19: use the new Iterator interface of Pager, changed all doctrine:build* task to use the new doctrine:build task

chapter 20: changed all doctrine:build* task to use the new doctrine:build task
chapter 21: replaced redirect() calls with the new support for objects
chapter 23: changed all doctrine:build* task to use the new doctrine:build task

Updated Italian translation of Jobeet 1.3 / Practical symfony 1.3 book

Updated Deprecations and removals in symfony 1.3 (added is_internal setting in the list of deprecated settings)

New Job Postings

Lead Developer/Senior LAMP Engineer at Astrum Solar Inc. - full-time based in Columbia, MD - More information

New symfony bloggers

metulo.net (feed) (English, and French)

Plugins

New plugins

rkProjectScaffolderPlugin: this project is built up to those who, like me, uses free time for planning and sketching projects

sfGoogleClosurePlugin: helps you fastly take advantage of Google's Closure JavaScript librearies

Updated plugins

sfExtraWidgetsPlugin: changed rating star style
sfEasyAuthPlugin: added base classes, added an option to allow users to log in with their email addresses or user names, confirmation emails can now be sent as HTML to improve deliverability, password reset emails are now sent in html, no need to redirect users after the auto-log-in filter so that has been removed to try to resolve problems with user sesions, the user filter now trims the user name and email address before searching for users, fixed a bug that would only return ea users who were authenticated, updated README, added a warning to the app.yml file about creating an sfEasyAuthUser class
sfGuardPlugin: created 1.3 branch
sfTaskLoggerPlugin: added new option thats allows to log only if there were things processed by the task, added new option to check if the task was already run once today, aded new option to check if the task is already running, fixed log file name and Propel schema

pkToolkitPlugin: cleaned up photo icons, new suggested standard fixtures settings, pkDoctrine::orderByList() allows query results to be returned in a fixed order by passing an array of object IDs, pkZendSearch now uses pkDoctrine::orderByList to provide portability between databases, use pkSignin::signin when privileges are lacking so that there's a chance for the user to log in, pkCheckboxEnables can now show/hide a selector in addition to the usual selector that gets enabled/disabled, JavaScript for a CRUD AJAX chunk form is now loaded at the end of the form so that jQuery code can affect things created by jQuery code inside the form's template and/or widgets
ysfOpenPlugin: fixed default app.yml configuration, added getAccessToken to ysfApplicationWebRequest to fetch oauth access tokens from request
sfDoctrineGuardPlugin: removed plugin form classes whose generation has been disabled and added basic test coverage of form classes
sfWeatherPlugin: changed weather icons, updated documentation
swBaseApplicationPlugin: tweaked CSS

pkContextCMSPlugin: implemented and documented view_locked_sufficient_credentials as an alternative to the simplistic "any logged in user can see locked pages" policy which is still the default, the plumbing is now there for page-specific view credentials but the UI needs to be built, fixed the multiple select elements on the page settings form were default HTML multiple select boxes due to a JS error, if you prefer new slots to appear at the bottom of areas rather than the top you can now set app_pkContextCMS_new_slots_top to false, first changes moving toward greater SQL92 compatibility, default users and groups now includes a view_locked permission for the guest group although you still have to tweak app.yml to turn on a credentials check for locked pages, good sfSyncContentPlugin settings for CMS sites
lcOpenInviterPlugin: committed first version, changed the $files_basebase_base values to the OpenInviter values, location of _base.php is declared properly now, commented out OpenInviter update procedure
sfDoctrineActAsTaggablePlugin: fixed indexes for the tag table were set up with bad schema.yml syntax
diemPlugin:

refactored the security plugin

renamed dmMigrateTask to dmGenerateMigrationTask
added admin user module classes for form and export
updated all user related classes to match new security subframework
changed all admin generator.yml table_method configuration to getAdminListQuery
made command line installer more readable
made cache_cleaner service extend dmConfigurable

disabled model validation in dmModuleManagerConfigHandler
fixed bug in dmDoctrineRecord->get
fixed bug in dmAdminGenerateTask when generating diem modules
fixed bug in dmDataTask when loading security groups
improved dmLoremizeTask output
fixed dmSecurityUser->signIn

fixed auth module layout choice
improved admin security modules configuration
fixed admin user module
made dmSecurityUser more robust and work without context instance
fixed auth layout choice when redisplaying the form after a wrong password
made possible to have 2 diem modules for 1 model

configured with_doctrine_route: false in all generator.yml files
made dmAPCCache more robust on cli environment
made dmConfig survive when dm_settings table does not exist
disabled all model checks in dmModuleManagerConfigHandler
added a Doctrine_Connection parameter to dmDb::pdo
fixed dmDoctrineQuery->whereDescendantId when the model has two or more diem modules
fixed warnings in dmFormDoctrine when embedded forms have been unsetted
fixed recursion madness in dmFileLog->fixLog
removed seo title prefix & suffix from dmSeoSynchronizer
fixed dmAdminFunctionalCoverageTest urls prefixes
fixed dmCoreFunctionalCoverageTest user signin simulation
made dmMediaResource throw an exception when the source is a new instance of DmMedia
removed deprecated noRightClick jQuery function from dmCorePlugins.js
fixed front widget filters and wrap classes
fixed front ajax edit actions expect a put method instead of a post
added dmUserPlugin tasks: change-password and promote

sfAtosPaymentPlugin: added setTransactionId
cleverFilesystemPlugin: more explicit error messages
lcFlowPlayerPlugin: submitted the plugin to the symfony svn repos
ncPropelChangeLogBehaviorPlugin: fixed Propel query criteria, whenever a field is rendered the 'table_name.field_name' event is triggered with the value of the field as the parameter
sfPhpunitPlugin: fixed SuiteLoader throws an exeption when try to use *, created classes for managing fixtures, added a module for easy runing tests and html visual result of testing, added security off for sfPhpunit module
sfFacebookConnectPlugin: added basic remember me filter

New symfony powered websites

People At Work: (English, and Italian) a company website
Sound Cave: (English, and Italian) an e-commerce (music cd - t-shirts) website
The (second) best job in the word: (English) Buzz/Competition to win a job as an International Shopping Consultant
Leproducasino: (French) learn online casino rules

They talked about us

Annonce en vidéo du forum PHP et conférences audio de Symfony 2009
Symfony - Snippet - Maneiras de acessar o objeto User
Tutorial Symfony: L'objet user, les accès et les sessions dans Symfony
Screencast del soporte de Symfony en Netbeans 6.8
symfony 1.3 beta available at ServerGrove
打鸟游戏修改版
Коррекция адреса веб-страницы
How to send an email with symfony 1.3 and Gmail
Using Mercurial as VCS for symfony
Symfony: Une utilisation du type array de Doctrine
Instalar Symfony en Fedora 11 - 3
Bughuntday – Symfony Project
Sympal installation fix
Installing Symfony and the jobeet tutorial
22 Open Source PHP Frameworks To Shorten Your Development Time
symfony ccで時間がかかる場合
ついったーのアイコンにsymfonyアイコンをつける
Symfony 2.0 akan menggunakan PHP 5.3
Ordenar cadenas de texto que contengan números en MySQL y Symfony
symfonyで"Hello World"を作成する

Be trained by symfony experts
- Dec 16 Paris - Jan 20 Paris - Feb 24 Paris - Mar 24 Paris [Less]

Using Propel 1.4 detailed logging

Today Propel 1.4 was released and it contains some debugging goodies.
We can use the DebugPDO class to get the nifty logging into the Web Debug Panel. However some more interesting information is turned off by default by Propel.
It ... [More] includes:

Time logging

Time spent for executing this query

Memory logging

Peak Usage during execution of the query
Total Memory usage after the query ran
Memory Delta caused by executing the query

Slow query logging

Duration after which a query is considered slow

Using this is very easy as of today / symfony 1.3 beta 2:

dev:
propel:
param:
classname: DebugPDO
debug:
realmemoryusage: true
details:
time:
enabled: true
slow:
enabled: true
threshold: 0.001
memdelta:
enabled: true
mempeak:
enabled: true
method:
enabled: true
mem:
enabled: true
querycount:
enabled: true

The whole list can be found in the Propel Documentation. The prefix debugpdo.logging is taken care of by the key debug. Simply put the remaining path below it, creating a new nesting level each dot.

Because Propel takes the order into account, the above configuration results into something like this:

Be trained by symfony experts
- Dec 16 Paris - Jan 20 Paris - Feb 24 Paris - Mar 24 Paris [Less]