a) what kind of autoloader are you using? Did you register all namespaces? I'm currently using the standard Zend_Loader_Autoloader from ZF 1.X and it works fine with Doctrine2 (no need for Doctrine Common autoloader). b) As I see you're trying to load stuff like "\Zend\Date();". ZF 1.X doesn't use php 5.3's namespaces, so you would just go for "\Zend_Date();" instead. c) If (b) wasn't the problem could you please show some of the exceptions thrown? d) "use \My\Entity\Base as My_Entity_Base;" - Is this a wanted behaviour? Marco Pivetta @Ocramius <http://twitter.com/Ocramius> http://marco-pivetta.com
On 18 April 2011 09:58, tridem-zend <nabble-z...@tridem.de> wrote: > I am switching from Zend_Db (including mappers and DbTable) to Doctrine > 2.0. > My former directory strucure was: > > /application/ > /application/models/ > /application/models/DbTable > /application/models/mappers > > So far so good I created my models from database including all relations. I > still have a copy of my old models and simply added the Doctrine entities > here: > > /application/ > /application/Entities/ > /application/Entities/Proxies > /application/Entities/Repositiories > /application/models/ > /application/models/DbTable > /application/models/mappers > > My old models extended an abstract class with methods like "toArray" or > "toDojoArray" etc. and I would like to continue using them. That's why I > tried to extend my Entity f.e.: > > > <?php > > namespace Entities; > > #use \Zend\Date as Zend_Date; > use \My\Entity\Base as My_Entity_Base; > > /** > * History > * > * @Table(name="history") > * @Entity(repositoryClass="\Entities\Repositories\HistoryRepository") > */ > class History extends My_Entity_Base > > > First of all is this a good idea? Unfortunately though my autoloading seems > to work fine I still have problems with using namespaces. Could someone > show > me the correct path to extend? > > My second problem is using Zend_* inside the entites f.e.: > > public function toDojoArray() > { > $creationDate = (!null == $this->getInsertDatetime()) ? new > \Zend\Date($this->getInsertDatetime()) : new \Zend\Date(); > > $data = array( > 'id' => $this->getId(), > 'name' => $this->getHistoryName(), > 'creationDate' => array( > "_type" => "Date", > "_value" => $creationDate->get(Zend_Date::ISO_8601) > ), > 'creationDate' => $this->getCreationDate() > ); > > return $data; > } > > > The Doctrine entity simply doesn't load the Zend library. > > Please help! Thanks! > > -- > View this message in context: > http://zend-framework-community.634137.n4.nabble.com/Extending-Doctrine-entities-using-Zend-an-My-library-tp3456839p3456839.html > Sent from the Zend Framework mailing list archive at Nabble.com. > > -- > List: fw-general@lists.zend.com > Info: http://framework.zend.com/archives > Unsubscribe: fw-general-unsubscr...@lists.zend.com > > >