Symfony 1.4 doctrine create table - doctrine

Can someone show me an example on how to use the createTable in Doctrine?
For example, I'd like to create a table 'attachment' with the following columns:
'file_path' =>string
'message_id'=>integer
Thanks

Found it :
$this->createTable('attachment', array(
'id' =>
array(
'type' => 'integer',
'length' => 8,
'autoincrement' => true,
'primary' => true,
),
'file_path' =>
array(
'type' => 'string',
'notnull' => true,
'length' => 255,
),
'message_id' =>
array(
'type' => 'integer',
'notnull' => false,
'length' => 8,
),
'created_at' =>
array(
'notnull' => true,
'type' => 'timestamp',
'length' => 25,
),
'updated_at' =>
array(
'notnull' => true,
'type' => 'timestamp',
'length' => 25,
),
), array(
'indexes' =>
array(
),
'primary' =>
array(
0 => 'id',
),
'collate' => 'utf8_general_ci',
'charset' => 'utf8',
));

Related

Elastica Mapping include_type_name

I'm trying to create a mapping from Elastica.
Here is my code to create my index with params of mapping :
$elasticaClient = new ElasticaClient;
$elasticaIndex = $elasticaClient->getIndex('products');
$elasticaIndex->create(
array(
'settings' => array(
'number_of_shards' => 1,
'number_of_replicas' => 0,
'analysis' => array(
'filter' => array(
'french_elision' => array(
'type' => 'elision',
'articles_case' => 'true',
'articles' => array("l", "m", "t", "qu", "n", "s", "j", "d", "c", "jusqu", "quoiqu", "lorsqu", "puisqu"),
),
'french_synonym' => array(
"type" => "synonym",
"ignore_case" => true,
"expand" => true,
"synonyms" => []
),
'french_stemmer' => array(
"type" => "stemmer",
"language" => "light_french"
)
),
'analyzer' => array(
'french_heavy' => array(
'type' => 'custom',
'tokenizer' => 'icu_tokenizer',
'filter' => array('french_elision', 'icu_folding', 'french_synonym', 'french_stemmer', 'asciifolding', 'lowercase')
),
'french_light' => array(
'type' => 'custom',
'tokenizer' => 'icu_tokenizer',
'filter' => array('french_elision', 'icu_folding', 'lowercase', 'asciifolding')
)
)
)
)
),
true
);
$elasticaType = $elasticaIndex->getType('product');
$mapping = new $mapping = new ElasticaTypeMapping;
$mapping->setType($elasticaType);
$mapping->setParam('index_analyzer', 'french_heavy');
$mapping->setParam('search_analyzer', 'french_light');
$mapping->setProperties(
array(
'name' => array(
'type' => 'string',
'boost' => 4
),
'description' => array(
'type' => 'string',
'boost' => 2
),
)
);
$mapping->send();
But I'm having the following error:
Types can not be provided in put mapping requests, unless the include_type_name parameter is set to true.
I can't find how to pass "include_type_name = true" in Ruflin/Elastica.
All my searches return examples in CURL ..
Thank a lot to help me
You seem to be running ES7 and include_type_name is false by default.
You can prevent that error from occurring by changing the last line with this one:
$mapping->send(['include_type_name' => true]);
It's WORK !!
Here is my config :
PHP 7.3.4
Symfony 4.3
Elasticsearch 7.0.1
composer require elasticsearch/elasticsearch "dev-master"
composer require ruflin/elastica "dev-master"
$elasticaClient = new ElasticaClient;
$elasticaIndex = $elasticaClient->getIndex('products');
$elasticaType = $elasticaIndex->getType('product');
$elasticaIndex->create(
array(
'settings' => array(
'number_of_shards' => 1,
'number_of_replicas' => 0,
'analysis' => array(
'filter' => array(
'french_elision' => array(
'type' => 'elision',
'articles_case' => 'true',
'articles' => array("l", "m", "t", "qu", "n", "s", "j", "d", "c", "jusqu", "quoiqu", "lorsqu", "puisqu"),
),
'french_synonym' => array(
"type" => "synonym",
"ignore_case" => true,
"expand" => true,
"synonyms" => []
),
'french_stemmer' => array(
"type" => "stemmer",
"language" => "light_french"
),
),
'analyzer' => array(
'french_heavy' => array(
'type' => 'custom',
'tokenizer' => 'icu_tokenizer',
'filter' => array('french_elision', 'icu_folding', 'french_synonym', 'french_stemmer', 'asciifolding', 'lowercase')
),
'french_light' => array(
'type' => 'custom',
'tokenizer' => 'icu_tokenizer',
'filter' => array('french_elision', 'icu_folding', 'lowercase', 'asciifolding')
),
)
)
)
),
true
);
$mapping = new ElasticaTypeMapping;
$mapping->setType($elasticaType);
$mapping->setProperties(
array(
'name' => array(
'type' => 'text',
'analyzer' => 'french_heavy',
'boost' => 4
),
'description' => array(
'type' => 'text',
'analyzer' => 'french_light',
'boost' => 2
),
)
);
$mapping->send(['include_type_name' => true]);

How to configure an entity as part of the second-level cache in DoctrineORMModule?

I was trying to configure memcached in DoctrineORM module of my Zendframework 2 project to perform caching queries, results and metadata follow this tutorial https://github.com/doctrine/DoctrineORMModule/blob/master/docs/cache.md
In module.config.php
<?php
return array(
'service_manager' => array(
'invokables' => array(
// ...
),
'factories' => array(
'doctrine.cache.my_memcached' => function ($sm) {
$cache = new \Doctrine\Common\Cache\MemcachedCache();
$memcache = new Memcached();
$memcache->addServer('localhost', 11211);
$cache->setMemcached($memcache);
return $cache;
},
'MemcachedFactory' => \Application\Service\Cache\MemcachedFactory::class,
)
),
'doctrine' => array(
'cache' => array(
'memcached' => array(
'namespace' => '_Doctrine',
'instance' => 'MemcachedFactory',
),
),
'configuration' => array(
'orm_default' => array(
'query_cache' => 'memcached',
'result_cache' => 'memcached',
'metadata_cache' => 'memcached',
'hydration_cache' => 'memcached',
'second_level_cache' => [
'enabled' => true,
'default_lifetime' => 200,
'default_lock_lifetime' => 500,
'file_lock_region_directory' => './data/cache',
'regions' => [
'My\FirstRegion\Name' => [
'lifetime' => 800,
'lock_lifetime' => 1000
],
'My\SecondRegion\Name' => [
'lifetime' => 10,
'lock_lifetime' => 20
],
],
],
),
),
'driver' => array(
'_driver' => array(
'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
'cache' => 'my_memcached',
'paths' => array(__DIR__ . '/../src/Application/Entity')
),
'orm_default' => array(
'drivers' => array(
'Application\Entity' => '_driver'
),
),
),
),
);
and after I create a method as the following:
public function findById($id) {
$qb = $this->entityManager->createQueryBuilder();
$qb->select("u")
->from(User::class, "u")
->where($qb->expr()->eq("u.id", ":id"))
->setParameter("id", (int) $id);
return $qb->getQuery()->setCacheable(true)->getOneOrNullResult();
}
and after, I get a Doctrine\ORM\Cache\CacheException
with message:
Entity "Application\Entity\User" not configured as part of the second-level cache.
Anyone who can suggest for me to solved this problem?
Add this to the USER class:
* #ORM\Cache(usage="NONSTRICT_READ_WRITE")

Magento 1.8: While adding new product attribute non of the frontend params are set to yes

This is code that I'm using to add new product attribute with frontend settings set to yes:
<?php
$installer = Mage::getResourceModel('catalog/setup','catalog_setup');
$installer->startSetup();
$installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, $specCode, array(
'group' => $profileGroupName,
'sort_order' => 1,
'type' => 'varchar',
'backend' => '',
'frontend' => '',
'label' => $specLabel,
'note' => $specNote,
'input' => 'text',
'class' => '',
'source' => '',
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
'required' => true,
'user_defined' => true,
'default' => '',
'unique' => false,
'used_for_promo_rules' => true,
'searchable' => true,
'filterable' => true,
'comparable' => true,
'visible' => true,
'visible_on_front' => true,
'visible_in_advanced_search' => true,
'is_configurable' => false
));
...
Almost all the frontend settings are set to true but after installing them in backend I can see that this settings are set to no.
Regards,
Fixed. Code that is working bellow. Just keep to the $attr array key names for this method _prepareValues in this two classes Mage_Eav_Model_Entity_Setup, Mage_Catalog_Model_Resource_Setup. Second class inherits form the first one so if you want to add frontend setting your installer needs to be an object from the second class.
$installer = new Mage_Catalog_Model_Resource_Setup();
$installer->startSetup();
$installer->addAttribute(Mage_Catalog_Model_Product::ENTITY, $tradeCode, array(
'group' => $profileGroupName,
'sort_order' => 1,
'type' => 'varchar',
'input' => 'text',
'label' => $tradeLabel,
'note' => $tradeNote,
'required' => 1,
'unique' => 0,
'user_defined' => 1,
'default' => '',
# Additional attribute data - forntend
'frontend_input_renderer' => '',
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
'visible' => 1,
'searchable' => 1,
'filterable' => 1,
'comparable' => 1,
'visible_on_front' => 1,
'wysiwyg_enabled' => 0,
'is_html_allowed_on_front' => 0,
'visible_in_advanced_search' => 1,
'filterable_in_search' => 1,
'used_in_product_listing' => 1,
'used_for_sort_by' => 1,
'apply_to' => '',
'position' => '',
'is_configurable' => 0,
'used_for_promo_rules' => 0,
));
...

How set a default Value with EAV AddAttribute

I want to set up an new attribute-set to my products in magento. This attribute should be type of selection from some options.
$installer->addAttribute('catalog_product', 'reserve', array(
'backend_label' => 'Attribute Reserve',
'type' => 'varchar',
'input' => 'select',
#'backend' => 'eav/entity_attribute_source_boolean',
'frontend' => '',
'source' => '',
#'default' => 1,
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
'visible' => true,
'required' => false,
'user_defined' => true,
'searchable' => false,
'filterable' => false,
'comparable' => false,
'visible_on_front' => false,
'visible_in_advanced_search' => false,
'unique' => false,
'option' => array(
'value' => array(
'optionone' => array( 'O' ),
'optiontwo' => array( 'P' ),
'optionthree' => array( 'Kein Angabe' ),
)
),
));
How can I set optionthree to default value?
Had the same problem. My solution:
$installer->addAttribute('catalog_product', 'reserve', array(
'backend_label' => 'Attribute Reserve',
'type' => 'int',
'input' => 'select',
#'backend' => 'eav/entity_attribute_source_boolean',
'frontend' => '',
'source' => 'eav/entity_attribute_source_table',
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
'visible' => true,
'required' => false,
'user_defined' => true,
'searchable' => false,
'filterable' => false,
'comparable' => false,
'visible_on_front' => false,
'unique' => false,
'visible_in_advanced_search' => false,
'option' => array(
'value' => array(
'optionone' => array( 'O' ),
'optiontwo' => array( 'P' ),
'optionthree' => array( 'Kein Angabe' ),
)
),
));
Notice the different type (int instead of varchar) and source (eav/entity_attribute_source_table). This is the way Magento represents typical select attributes. Now you can set the default value like this:
$model = Mage::getModel('eav/entity_attribute')
->load($installer->getAttributeId('catalog_product', 'reserve'));
$model
->setDefaultValue($model->getSource()->getOptionId('Keine Angabe'))
->save();
Please use this script:-
$installer->addAttribute('catalog_product', 'reserve', array(
'backend_label' => 'Attribute Reserve',
'type' => 'varchar',
'input' => 'select',
#'backend' => 'eav/entity_attribute_source_boolean',
'frontend' => '',
'source' => '',
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
'visible' => true,
'required' => false,
'user_defined' => true,
'searchable' => false,
'filterable' => false,
'comparable' => false,
'visible_on_front' => false,
'unique' => false,
'visible_in_advanced_search' => false,
'option' => array(
'value' => array(
'optionone' => array( 'O' ),
'optiontwo' => array( 'P' ),
'optionthree' => array( 'Kein Angabe' ),
)
),
/**
* This will set the default values,
* as "array" data type is being used to set proper default value
*/
'default' => array(
'optionthree'
),
));
Hope it helps.
Navigate to Catalog >Manage Attributes to create new attribute and manage attribue stes to create new attribute set.
Please check the screenshot

Execution of subquery within table class gives class not found [doctrine]

In table class Ouders I do the following query:
$q = $this->createQuery('o')
->where('o.ouderid IN (SELECT DISTINCT k.parentid FROM Kinderen k WHERE k.schoolid = ?)', $schoolcode)
->orderBy('o.achternaam');
As you can see it has a subquery to the table class Kinderen.
Why does it give the error?:
An error occurred
Application error
Exception information:
Message: Couldn't find class Kinderen
Stack trace:
#0 /var/www/bredeschool/app/library/Doctrine/Table.php(256): Doctrine_Table->initDefinition()
#1 /var/www/bredeschool/app/library/Doctrine/Connection.php(1126): Doctrine_Table->__construct('Kinderen', Object(Doctrine_Connection_Mysql), true)
#2 /var/www/bredeschool/app/library/Doctrine/Query.php(1934): Doctrine_Connection->getTable('Kinderen')
#3 /var/www/bredeschool/app/library/Doctrine/Query.php(1732): Doctrine_Query->loadRoot('Kinderen', 'k')
#4 /var/www/bredeschool/app/library/Doctrine/Query/From.php(88): Doctrine_Query->load('Kinderen k')
#5 /var/www/bredeschool/app/library/Doctrine/Query/Abstract.php(2077): Doctrine_Query_From->parse('Kinderen k')
#6 /var/www/bredeschool/app/library/Doctrine/Query.php(1160): Doctrine_Query_Abstract->_processDqlQueryPart('from', Array)
#7 /var/www/bredeschool/app/library/Doctrine/Query.php(1126): Doctrine_Query->buildSqlQuery(true)
#8 /var/www/bredeschool/app/library/Doctrine/Query.php(843): Doctrine_Query->getSqlQuery()
#9 /var/www/bredeschool/app/library/Doctrine/Query.php(813): Doctrine_Query->parseSubquery('(SELECT DISTINC...')
#10 /var/www/bredeschool/app/library/Doctrine/Query.php(697): Doctrine_Query->parseFunctionExpression('(SELECT DISTINC...')
#11 /var/www/bredeschool/app/library/Doctrine/Query/Where.php(121): Doctrine_Query->parseClause('(SELECT DISTINC...')
#12 /var/www/bredeschool/app/library/Doctrine/Query/Where.php(81): Doctrine_Query_Where->_buildSql('o.ouderid', 'IN', '(SELECT DISTINC...')
#13 /var/www/bredeschool/app/library/Doctrine/Query/Condition.php(92): Doctrine_Query_Where->load('o.ouderid IN (S...')
#14 /var/www/bredeschool/app/library/Doctrine/Query/Abstract.php(2077): Doctrine_Query_Condition->parse('o.ouderid IN (S...')
#15 /var/www/bredeschool/app/library/Doctrine/Query.php(1160): Doctrine_Query_Abstract->_processDqlQueryPart('where', Array)
#16 /var/www/bredeschool/app/library/Doctrine/Query.php(1126): Doctrine_Query->buildSqlQuery(true)
#17 /var/www/bredeschool/app/library/Doctrine/Query/Abstract.php(958): Doctrine_Query->getSqlQuery(Array)
#18 /var/www/bredeschool/app/library/Doctrine/Query/Abstract.php(1026): Doctrine_Query_Abstract->_execute(Array)
#19 /var/www/bredeschool/app/application/models/OudersTable.php(34): Doctrine_Query_Abstract->execute()
#20 /var/www/bredeschool/app/application/controllers/OudersController.php(44): Model_OudersTable->getView('111')
#21 /var/www/bredeschool/app/library/Zend/Controller/Action.php(513): OudersController->listAction()
#22 /var/www/bredeschool/app/library/Zend/Controller/Dispatcher/Standard.php(295): Zend_Controller_Action->dispatch('listAction')
#23 /var/www/bredeschool/app/library/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#24 /var/www/bredeschool/app/library/Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front->dispatch()
#25 /var/www/bredeschool/app/library/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#26 /var/www/bredeschool/bredeschoolzuidoost.nl/app/index.php(28): Zend_Application->run()
#27 {main}
Request Parameters:
array (
'controller' => 'ouders',
'action' => 'list',
'module' => 'default',
)
Kinderen model
// Connection Component Binding
Doctrine_Manager::getInstance()->bindComponent('Model_Kinderen', 'doctrine');
/**
* Model_Base_Kinderen
*
* This class has been auto-generated by the Doctrine ORM Framework
*
* #property integer $kindid
* #property integer $parentid
* #property string $naamouder
* #property string $naambov1
* #property string $telefoonbov1
* #property string $relatiebov1
* #property string $naambov2
* #property string $telefoonbov2
* #property string $relatiebov2
* #property string $voornaam
* #property string $tussenvoegsel
* #property string $achternaam
* #property date $geboortedatum
* #property string $jomei
* #property integer $schoolid
* #property string $jufmeester
* #property integer $groep
* #property string $bijzonderheden
* #property string $zelfstandigheid
* #property string $opvang
* #property string $dagvdweek
* #property string $overig
* #property string $bso
* #property string $zwemdiploma
* #property timestamp $aanmaakdatum
* #property string $aanmeldwijze
*
* #package ##PACKAGE##
* #subpackage ##SUBPACKAGE##
* #author ##NAME## <##EMAIL##>
* #version SVN: $Id: Builder.php 7490 2010-03-29 19:53:27Z jwage $
*/
abstract class Model_Base_Kinderen extends Doctrine_Record
{
public function setTableDefinition()
{
$this->setTableName('kinderen');
$this->hasColumn('kindid', 'integer', 4, array(
'type' => 'integer',
'fixed' => 0,
'unsigned' => false,
'primary' => true,
'autoincrement' => true,
'length' => '4',
));
$this->hasColumn('parentid', 'integer', 4, array(
'type' => 'integer',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => true,
'autoincrement' => false,
'length' => '4',
));
$this->hasColumn('naamouder', 'string', 100, array(
'type' => 'string',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => false,
'autoincrement' => false,
'length' => '100',
));
$this->hasColumn('naambov1', 'string', 100, array(
'type' => 'string',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => false,
'autoincrement' => false,
'length' => '100',
));
$this->hasColumn('telefoonbov1', 'string', 20, array(
'type' => 'string',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => false,
'autoincrement' => false,
'length' => '20',
));
$this->hasColumn('relatiebov1', 'string', 100, array(
'type' => 'string',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => false,
'autoincrement' => false,
'length' => '100',
));
$this->hasColumn('naambov2', 'string', 100, array(
'type' => 'string',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => false,
'autoincrement' => false,
'length' => '100',
));
$this->hasColumn('telefoonbov2', 'string', 20, array(
'type' => 'string',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => false,
'autoincrement' => false,
'length' => '20',
));
$this->hasColumn('relatiebov2', 'string', 100, array(
'type' => 'string',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => false,
'autoincrement' => false,
'length' => '100',
));
$this->hasColumn('voornaam', 'string', 100, array(
'type' => 'string',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => false,
'autoincrement' => false,
'length' => '100',
));
$this->hasColumn('tussenvoegsel', 'string', 50, array(
'type' => 'string',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => false,
'autoincrement' => false,
'length' => '50',
));
$this->hasColumn('achternaam', 'string', 100, array(
'type' => 'string',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => false,
'autoincrement' => false,
'length' => '100',
));
$this->hasColumn('geboortedatum', 'date', 25, array(
'type' => 'date',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => false,
'autoincrement' => false,
'length' => '25',
));
$this->hasColumn('jomei', 'string', 10, array(
'type' => 'string',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => false,
'autoincrement' => false,
'length' => '10',
));
$this->hasColumn('schoolid', 'integer', 2, array(
'type' => 'integer',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => false,
'autoincrement' => false,
'length' => '2',
));
$this->hasColumn('jufmeester', 'string', 50, array(
'type' => 'string',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => false,
'autoincrement' => false,
'length' => '50',
));
$this->hasColumn('groep', 'integer', 1, array(
'type' => 'integer',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => false,
'autoincrement' => false,
'length' => '1',
));
$this->hasColumn('bijzonderheden', 'string', 500, array(
'type' => 'string',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => false,
'autoincrement' => false,
'length' => '500',
));
$this->hasColumn('zelfstandigheid', 'string', 75, array(
'type' => 'string',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => false,
'autoincrement' => false,
'length' => '75',
));
$this->hasColumn('opvang', 'string', 100, array(
'type' => 'string',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => false,
'autoincrement' => false,
'length' => '100',
));
$this->hasColumn('dagvdweek', 'string', 100, array(
'type' => 'string',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => false,
'autoincrement' => false,
'length' => '100',
));
$this->hasColumn('overig', 'string', 400, array(
'type' => 'string',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => false,
'autoincrement' => false,
'length' => '400',
));
$this->hasColumn('bso', 'string', 50, array(
'type' => 'string',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => false,
'autoincrement' => false,
'length' => '50',
));
$this->hasColumn('zwemdiploma', 'string', 5, array(
'type' => 'string',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => false,
'autoincrement' => false,
'length' => '5',
));
$this->hasColumn('aanmaakdatum', 'timestamp', 25, array(
'type' => 'timestamp',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => false,
'autoincrement' => false,
'length' => '25',
));
$this->hasColumn('aanmeldwijze', 'string', 20, array(
'type' => 'string',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => true,
'autoincrement' => false,
'length' => '20',
));
}
public function setUp()
{
parent::setUp();
$timestampable0 = new Doctrine_Template_Timestampable(array(
'created' =>
array(
'name' => 'aanmaakdatum',
),
'updated' =>
array(
'disabled' => true,
),
));
$this->actAs($timestampable0);
}
}
Ouders model
// Connection Component Binding
Doctrine_Manager::getInstance()->bindComponent('Model_Ouders', 'doctrine');
/**
* Model_Base_Ouders
*
* This class has been auto-generated by the Doctrine ORM Framework
*
* #property integer $ouderid
* #property integer $userid
* #property integer $clusterid
* #property string $voornaam
* #property string $tussenvoegsel
* #property string $achternaam
* #property string $straat
* #property string $huisnummer
* #property string $postcode
* #property string $woonplaats
* #property string $telefoonvast
* #property string $telefoonmobiel
* #property string $telefoonwerk
* #property string $emailadres
* #property string $stadspas
* #property integer $inkomensniveau
* #property timestamp $aanmaakdatum
*
* #package ##PACKAGE##
* #subpackage ##SUBPACKAGE##
* #author ##NAME## <##EMAIL##>
* #version SVN: $Id: Builder.php 7490 2010-03-29 19:53:27Z jwage $
*/
abstract class Model_Base_Ouders extends Doctrine_Record
{
public function setTableDefinition()
{
$this->setTableName('ouders');
$this->hasColumn('ouderid', 'integer', 4, array(
'type' => 'integer',
'fixed' => 0,
'unsigned' => false,
'primary' => true,
'autoincrement' => true,
'length' => '4',
));
$this->hasColumn('userid', 'integer', 2, array(
'type' => 'integer',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => true,
'autoincrement' => false,
'length' => '2',
));
$this->hasColumn('clusterid', 'integer', 4, array(
'type' => 'integer',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => false,
'autoincrement' => false,
'length' => '4',
));
$this->hasColumn('voornaam', 'string', 100, array(
'type' => 'string',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => false,
'autoincrement' => false,
'length' => '100',
));
$this->hasColumn('tussenvoegsel', 'string', 50, array(
'type' => 'string',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => false,
'autoincrement' => false,
'length' => '50',
));
$this->hasColumn('achternaam', 'string', 100, array(
'type' => 'string',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => false,
'autoincrement' => false,
'length' => '100',
));
$this->hasColumn('straat', 'string', 100, array(
'type' => 'string',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => false,
'autoincrement' => false,
'length' => '100',
));
$this->hasColumn('huisnummer', 'string', 20, array(
'type' => 'string',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => false,
'autoincrement' => false,
'length' => '20',
));
$this->hasColumn('postcode', 'string', 7, array(
'type' => 'string',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => false,
'autoincrement' => false,
'length' => '7',
));
$this->hasColumn('woonplaats', 'string', 100, array(
'type' => 'string',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => false,
'autoincrement' => false,
'length' => '100',
));
$this->hasColumn('telefoonvast', 'string', 20, array(
'type' => 'string',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => false,
'autoincrement' => false,
'length' => '20',
));
$this->hasColumn('telefoonmobiel', 'string', 20, array(
'type' => 'string',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => false,
'autoincrement' => false,
'length' => '20',
));
$this->hasColumn('telefoonwerk', 'string', 20, array(
'type' => 'string',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => false,
'autoincrement' => false,
'length' => '20',
));
$this->hasColumn('stadspas', 'string', 20, array(
'type' => 'string',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => false,
'autoincrement' => false,
'length' => '20',
));
$this->hasColumn('inkomensniveau', 'integer', 1, array(
'type' => 'integer',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => false,
'autoincrement' => false,
'length' => '1',
));
$this->hasColumn('aanmaakdatum', 'timestamp', 25, array(
'type' => 'timestamp',
'fixed' => 0,
'unsigned' => false,
'primary' => false,
'notnull' => true,
'autoincrement' => false,
'length' => '25',
));
}
public function setUp()
{
parent::setUp();
$timestampable0 = new Doctrine_Template_Timestampable(array(
'created' =>
array(
'name' => 'aanmaakdatum',
),
'updated' =>
array(
'disabled' => true,
),
));
$this->actAs($timestampable0);
}
}
Thanks a lot!
Chris
As far as I noticed your model classes are named Model_Kinderen and Model_Ouders but in DQL subquery you use Kinderen. Kinderen is your database table name.
DQL is not SQL. You should work with objects and not tables.
I'm sorry if I missed something. I'm not really familiar with Zend as a framework.

Resources