Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip properties when use ghost objects #221

Merged

Conversation

malukenho
Copy link
Collaborator

$properties
);

$ghostObject->$propertyName;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This access will fail for private/protected properties. Also, you should assert on the value of the property once retrieved

@malukenho malukenho force-pushed the feature/allow-skipping-properties branch 3 times, most recently from c0e6455 to 7d76711 Compare January 3, 2015 04:04
$publicProperties = new PublicPropertiesMap($originalClass);
$privateProperties = new PrivatePropertiesMap($originalClass);
$publicProperties = new PublicPropertiesMap($originalClass, $properties);
$privateProperties = new PrivatePropertiesMap($originalClass, $properties);
$protectedProperties = new ProtectedPropertiesMap($originalClass);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not filtered?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ocramius not because, I'm trying to make public and private pass first. But don't happens :'(

@Ocramius Ocramius self-assigned this Jan 5, 2015
@Ocramius Ocramius added this to the 2.0.0 milestone Jan 5, 2015
@@ -36,6 +37,13 @@ class LazyLoadingGhostFactory extends AbstractLazyFactory
*/
private $generator;

public function createProxy($className, Closure $initializer, array $properties = [])
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can probably be removed: $properties can go to the parent class IMO

$this->assertArrayNotHasKey($propertyName, $filteredProperties->$methodToGetProperties());
}

public function propertiesToSkipFixture()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't mix data providers and test methods. Move the data-provider to the bottom

@malukenho malukenho force-pushed the feature/allow-skipping-properties branch from 6cdb6e1 to 2a7d5cf Compare January 7, 2015 01:10
new ReflectionClass(ClassWithMixedProperties::class)
);

$this->assertArrayHasKey($propertyName, $properties->$methodToGetProperties());
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this simply be re-designed to use getInstanceProperties()? I don't like the dynamic method call here :-)

malukenho added 3 commits January 8, 2015 02:44
…oading-ghost-should-return-boolean

Hotfix: call initializer on lazy loading ghost should return boolean result
@Ocramius Ocramius merged commit aa229e6 into Ocramius:master Jan 8, 2015
Ocramius added a commit that referenced this pull request Jan 8, 2015
Ocramius added a commit that referenced this pull request Jan 8, 2015
Ocramius added a commit that referenced this pull request Jan 8, 2015
@Ocramius
Copy link
Owner

Ocramius commented Jan 8, 2015

@malukenho merged, thanks!

@Ocramius Ocramius changed the title [WIP] Skip properties when use ghost objects Skip properties when use ghost objects Jan 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants