Coder Social home page Coder Social logo

borisguery / bgylibrary Goto Github PK

View Code? Open in Web Editor NEW
62.0 62.0 24.0 74 KB

**This library is NOT MAINTAINED anymore.** Extension of Zend Framework, provides Doctrine 2 integration, Entity Serialization, toArray(), common filters, views helpers, and more.

Home Page: http://borisguery.github.com/bgylibrary

PHP 100.00%

bgylibrary's People

Contributors

borisguery avatar powerkiki avatar wildlyinaccurate avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

bgylibrary's Issues

ZF2

Can you convert this project for Zend Framework 2? Please.

EntitySerializer::toJson()

onjour Boris,
J’ai énormément de mal à utiliser EntitySerializer::toJson().
C’est vraiment pas simple.

J’ai rajouté les méthodes suivantes dans mes classes Entity:
public function __set($property, $value) {
$this->$property = $value;
}
public function toArray() {
return get_object_vars($this);
}
public function toJson() {
return json_encode($this);
}

Ensuite dans mon controlleur je peux faire :

$view = new JsonModel(array(
‘adresse’ => \Zend\Json\Json::encode($candidat->getAdresse(),true)
));
return $view;

true étant censé me sérialiser les objets liés.
Comme ca marche pas super, j’essaie ta méthode:

$entitySerializer = new \Mix\Doctrine\EntitySerializer($this->getEm());

$view = new JsonModel(array(
‘adresse’ => $entitySerializer->toJson($candidat->getAdresse())
));
return $view;

Ca marche pas non plus, soit j’ai des NULL pour les clés étrangeres soit j’ai meme pas les champs.
De plus j’ai un attribut isInitialized bizarre.

{« adresse »: »{\ »isInitialized\ »:true} »}

Pour info $candidat->getAdresse() est un proxy sur ma classe Entity\Adresse.

En debuggant j'ai ici:
https://github.com/borisguery/bgylibrary/blob/master/library/Bgy/Doctrine/EntitySerializer.php#L80

$data[$key] retourne null

\Zend\debug::dump($metadata->reflFields[$field]);

object(ReflectionProperty)#3530 (2) {
["name"] => string(11) « countryCode »
["class"] => string(14) « Entity\Adresse »
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.