Skip to content

Instantly share code, notes, and snippets.

@hhamon
Created October 13, 2011 22:25
Show Gist options
  • Save hhamon/1285726 to your computer and use it in GitHub Desktop.
Save hhamon/1285726 to your computer and use it in GitHub Desktop.
<?php
------ Symfony2 API ---------------
interface UserInterface
{
// ...
public function equals(UserInterface $user);
}
------ Propel API ---------------
abstract class BaseObject
{
public function equals($obj)
{
// ...
}
}
------ My Propel Model Classes in My Symfony2 Bundle ---------------
class MyPropelUser extends BaseMyPropelUser implements UserInterface
{
// Conflict because BaseObject::equals() and UserInterface::equals() methods
// don't have the same signature.
}
@fzaninotto
Copy link

Now I get it...

@fzaninotto
Copy link

And of course it doesn't work if MyPropelUser::equals() signature is UserInterface $obj?

@hhamon
Copy link
Author

hhamon commented Oct 13, 2011

So I'm a bit fucked up now ^^

@hhamon
Copy link
Author

hhamon commented Oct 13, 2011

No it does not work... You must respect the BaseObject::equals() method... That's why I want method overloading in PHP.

@nibsirahsieu
Copy link

I encountered the same problem a few months ago, http://groups.google.com/group/symfony-users/browse_thread/thread/2eac5aeb5fcc5131?hl=en. For now i just create 'Proxy class' as suggested by willdurand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment