Comments (5)
i see this is actually an issue with your serialiser nilportugues/php-serializer#14
from php-json-api.
Perhaps not : The JsonApiSerializer extends DeepCopySerializer which doesn't seem to protect against circular dependencies...
from php-json-api.
Circular dependencies are bad design.
I can code against bad design, but it really introduces lots of complexity to the library to support a bad practice.
from php-json-api.
Hi, I rather do it right then wrong... But I would argue circular dependencies aren't bad design perse. They exist in doctrine entities. Think of a one to many relationship. Although I am never interested in traversing the identity from a Preference. I want the relationship defined in the owning side (preference) becuase of the constained advantage the cascade option gives me. (When ever I remove a user all his preferences are also deleted.)
ps. Simply changing the DeepCopySericalizer to Serializer fixed this...
<?xml version="1.0"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xsi="http://www.w3.org/2001/XMLSchema-instance" schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Identity">
<id name="id" type="integer">
<generator strategy="AUTO"/>
</id>
<field name="name" type="string" length="255" nullable="true"/>
<one-to-many field="preference" target-entity="Preference" mapped-by="identity"/>
</entity>
</doctrine-mapping>
<?xml version="1.0"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xsi="http://www.w3.org/2001/XMLSchema-instance" schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Preference">
<id name="id" type="integer">
<generator strategy="AUTO"/>
</id>
<field name="name" type="string" length="255" nullable="true"/>
<many-to-one field="identity" target-entity="Identity" inversed-by="preference">
<join-columns>
<join-column name="identity_id" referenced-column-name="id" on-delete="CASCADE"/>
</join-columns>
</many-to-one>
</entity>
</doctrine-mapping>
from php-json-api.
thoughts? advise? still stuck at serialising entities
from php-json-api.
Related Issues (20)
- [Insight] Unused method, property, variable or parameter - in src/Server/Data/DataObject.php, line 198 HOT 1
- [Insight] Unused method, property, variable or parameter - in src/Server/Query/QueryObject.php, line 91 HOT 1
- [Insight] Unused method, property, variable or parameter - in src/Server/Query/QueryObject.php, line 120 HOT 1
- [Insight] Unused method, property, variable or parameter - in src/Server/Data/DataAssertions.php, line 131 HOT 1
- Undefined index in DataIncludedHelper.php on line 77 HOT 1
- Write test for relationships HOT 1
- Do not remove ID from attributes HOT 2
- Remove $type checks in $mappings as it's the very first thing done since 2.3 HOT 1
- If ID property is an array, flatten array.
- Add support of optional parameters in NilPortugues\Api\JsonApi\Server\Actions\CreateResource HOT 3
- Naming convention of data attributes keys HOT 2
- Add support of "relationships" in resource creation. HOT 1
- Deeply nested array of objects HOT 2
- hiddenFields exposed in relationships
- Silent DataException in DataObject HOT 1
- MappingFactory::fromArray() always seems to unbox the array HOT 1
- DataAssertions requires an Attributes member
- Authentication and authorizations HOT 1
- Id Field Aliasing
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-json-api.