Merged all open PR's request into one pull request#188
Merged all open PR's request into one pull request#188jkwakman wants to merge 67 commits intofloriansemm:masterfrom
Conversation
PHPUnit v5 namespace is deprecated. Changed it to the new v6 namespace.
PHPUnit v5 namespace is deprecated. Changed it to the new v6 namespace.
PHPUnit v5 namespace is deprecated. Changed it to the new v6 namespace.
PHPUnit v5 namespace is deprecated. Changed it to the new v6 namespace.
PHPUnit v5 namespace is deprecated. Changed it to the new v6 namespace.
PHPUnit v5 namespace is deprecated. Changed it to the new v6 namespace.
PHPUnit v5 namespace is deprecated. Changed it to the new v6 namespace.
PHPUnit v5 namespace is deprecated. Changed it to the new v6 namespace.
PHPUnit v5 namespace is deprecated. Changed it to the new v6 namespace.
PHPUnit v5 namespace is deprecated. Changed it to the new v6 namespace.
PHPUnit v5 namespace is deprecated. Changed it to the new v6 namespace.
PHPUnit v5 namespace is deprecated. Changed it to the new v6 namespace.
PHPUnit v5 namespace is deprecated. Changed it to the new v6 namespace.
PHPUnit v5 namespace is deprecated. Changed it to the new v6 namespace.
PHPUnit v5 namespace is deprecated. Changed it to the new v6 namespace.
PHPUnit v5 namespace is deprecated. Changed it to the new v6 namespace.
PHPUnit v5 namespace is deprecated. Changed it to the new v6 namespace.
PHPUnit v5 namespace is deprecated. Changed it to the new v6 namespace.
Current version of phpunit. Support untill 1 feb 2019.
Here we test if the field Alias is working as expected.
When using the OnetoMany relation we often do not want the parameter name as the fieldname in the Solr database. For example.. Company -> Orders ($orders) -> getOrderNumber() Here the fieldname will be casted to orders_ss in the solr_database. Instead we want order_id_ss. To arrange this behaviour we added the fieldAlias in the annotation. * @solr\Field(type="strings", getter="getOrderId", fieldAlias="order_id")
To define an alias field name for the database entry you can use the fieldAlias in the @solr\Field tag.
Added a db example after code review
Added typo fix from costom to custom.
Added typo fix from costom to custom.
Added typo fix from costom to custom.
Added typo fix from costom to custom.
Added typo fix from costom to custom.
Added typo fix from costom to custom.
This fix adds a compatibility layer for ext-mongo (SolrBundle uses Do…
…ation Jkwakman field alias doctrine relation
Jkwakman one to many relations
Jkwakman phpunit 6
Jkwakman typo refactor costom
|
I will test your pull-request in the end of the week |
floriansemm
left a comment
There was a problem hiding this comment.
There is a bug in the annotation reader class. I have add locally a test case
/**
* @test
*/
public function readPropertiesFromFields()
{
$entity = new EntityWithFields();
$nested = new ValidTestEntity();
$nested->setId(rand(1, 10000));
$nested->setTitle('title 123');
$entity->setFields([$entity]);
$this->reader->getFields($entity);
}
// ....
class EntityWithFields
{
/**
* @Solr\Fields(getter="getFields", fields={
* @Solr\Field(type="integers", getter="getId", fieldAlias="id"),
* @Solr\Field(type="strings", getter="getTitle", fieldAlias="title")
* })
*/
private $fields;
/**
* @return mixed
*/
public function getFields()
{
return $this->fields;
}
/**
* @param mixed $fields
*/
public function setFields($fields)
{
$this->fields = $fields;
}
}This causes an exception Unknown method "getId" configured which I would not expect here.
| $property->setAccessible(true); | ||
| $annotation->value = $property->getValue($entity); | ||
| $annotation->name = $property->getName(); | ||
| if($type == $this::FIELDS_CLASS) { |
There was a problem hiding this comment.
missing space between if and bracket
| $field->getter = $method; | ||
|
|
||
| } else { | ||
| throw new AnnotationReaderException(sprintf('Unknown method "%s" configured', $method)); |
There was a problem hiding this comment.
add class in the exception message
|
Dear Florian, Thank you for you're time reviewing my PR. I have added the following changes (see commits):
testGetFields_NoParentGetter
Can you please reevaluate my PR? If you require any further information, feel free to contact me. Kind regards, Jack Kwakman |
|
I have tested your feature with an When I persist a post then an error is logged:
$post = new Post();
$post->setTitle('post with fields');
$post->setText('text');
$tag1 = new Tag();
$tag1->setName('tag #1');
$tag2 = new Tag();
$tag2->setName('tag #2');
$post->setTags([$tag1, $tag2]);
// save $post comes here....Did I have misunderstood the documentation? |
|
Dear Florian, I have reevaluated the changes with the example in the docs. I have e-mailed the example entities so we can be sure we test the same setup. These entities are working without errors on my side and update the Solr database with the following result: { Can you please (re)reevaluate my PR? If you require any further information, feel free to contact me. Kind regards, Jack Kwakman |
Thank you for checking my changes. The problem lies in the fact that the current logic for the EntityIndexerSubsriber binds to the postPersist event. I have changes this to the onFlush event so we have access to all the relational data. Now the id's get persisted as expected. Changes per file: AnnotationReader: Allow empty relations to be nullable DocumentFactory: FieldValue should not be required EntityIndexerSubscriber: Changed the indexer to onFlush instead of postPersist. At that point the ORM relations are available. Can you please (re)reevaluate my PR? If you require any further information, feel free to contact me. Kind regards, Jack Kwakman
Thank you for checking my changes. The problem lies in the fact that the current logic for the EntityIndexerSubsriber binds to the postPersist event. I have changes this to the onFlush event so we have access to all the relational data. Now the id's get persisted as expected. Changes per file: AnnotationReader: Allow empty relations to be nullable DocumentFactory: FieldValue should not be required EntityIndexerSubscriber: Changed the indexer to onFlush instead of postPersist. At that point the ORM relations are available. Can you please (re)reevaluate my PR? If you require any further information, feel free to contact me. Kind regards, Jack Kwakman
Thank you for checking my changes. The problem lies in the fact that the current logic for the EntityIndexerSubsriber binds to the postPersist event. I have changes this to the onFlush event so we have access to all the relational data. Now the id's get persisted as expected. Changes per file: AnnotationReader: Allow empty relations to be nullable DocumentFactory: FieldValue should not be required EntityIndexerSubscriber: Changed the indexer to onFlush instead of postPersist. At that point the ORM relations are available. Can you please (re)reevaluate my PR? If you require any further information, feel free to contact me. Kind regards, Jack Kwakman
Bundled all changes into one PR. Merging and maintaining all the separate PR's causes a mess.